<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.intlcalendar.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'intlcalendar.createinstance.php',
    1 => 'IntlCalendar::createInstance',
    2 => '新しい IntlCalendar を作成する',
  ),
  'up' => 
  array (
    0 => 'class.intlcalendar.php',
    1 => 'IntlCalendar',
  ),
  'prev' => 
  array (
    0 => 'intlcalendar.construct.php',
    1 => 'IntlCalendar::__construct',
  ),
  'next' => 
  array (
    0 => 'intlcalendar.equals.php',
    1 => 'IntlCalendar::equals',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/intl/intlcalendar/createinstance.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="intlcalendar.createinstance" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlCalendar::createInstance</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL &gt;= 3.0.0a1)</p><p class="refpurpose"><span class="refname">IntlCalendar::createInstance</span> &mdash; <span class="dc-title">新しい IntlCalendar を作成する</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlcalendar.createinstance-description">
  <h3 class="title">説明</h3>
  <p class="para">
   オブジェクト指向型
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>IntlCalendar::createInstance</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.intltimezone.php" class="type IntlTimeZone">IntlTimeZone</a></span>|<span class="type"><a href="class.datetimezone.php" class="type DateTimeZone">DateTimeZone</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$timezone</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$locale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.intlcalendar.php" class="type IntlCalendar">IntlCalendar</a></span></span></div>

  <p class="para rdfs-comment">
   手続き型
  </p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>intlcal_create_instance</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.intltimezone.php" class="type IntlTimeZone">IntlTimeZone</a></span>|<span class="type"><a href="class.datetimezone.php" class="type DateTimeZone">DateTimeZone</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$timezone</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$locale</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.intlcalendar.php" class="type IntlCalendar">IntlCalendar</a></span></span></div>

  <p class="para rdfs-comment">
   指定されたタイムゾーンとロケールを使い、
   <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> を作成します。
   このファクトリメソッドは
   <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> のサブクラスを返す可能性があります。
  </p>
  <p class="para">
   作成されたカレンダーオブジェクトは、
   システムの時刻を基準とした、作成時点の時刻を表すインスタンスです。
   フィールドは <span class="function"><strong>IntCalendar::clear()</strong></span>
   を引数なしでコールすることですべてクリアできます。
   <span class="function"><a href="intlgregoriancalendar.construct.php" class="function">IntlGregorianCalendar::__construct()</a></span>
   も参照ください。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-intlcalendar.createinstance-parameters">
  <h3 class="title">パラメータ</h3>
  <dl>
   
    <dt><code class="parameter">timezone</code></dt>
    <dd>
     <p class="para">
      使用するタイムゾーン。
     </p>
     


<ul class="itemizedlist">
 <li class="listitem">
  <p class="para">
   <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>。この場合はデフォルトのタイムゾーンを使います。デフォルトは、ini 項目
   <a href="datetime.configuration.php#ini.date.timezone" class="link">date.timezone</a> で設定したものか、
   <span class="function"><a href="function.date-default-timezone-set.php" class="function">date_default_timezone_set()</a></span> 関数で指定したもの
   (そして <span class="function"><a href="function.date-default-timezone-get.php" class="function">date_default_timezone_get()</a></span> が返すもの) になります。
  </p>
 </li>
 <li class="listitem">
  <p class="para">
   <span class="classname"><a href="class.intltimezone.php" class="classname">IntlTimeZone</a></span>。これを直接使います。
  </p>
 </li>
 <li class="listitem">
  <p class="para">
   <span class="classname"><a href="class.datetimezone.php" class="classname">DateTimeZone</a></span>。その識別子を取り出して、ICU タイムゾーンオブジェクトを作ります。
   つまり、これは ICU のデータベースに基づくタイムゾーンとなり、PHP のタイムゾーンデータベースに基づくものではありません。
  </p>
 </li>
 <li class="listitem">
  <p class="para">
   文字列。ICU タイムゾーン識別子として有効なものを指定します。
   <span class="function"><a href="intltimezone.createtimezoneidenumeration.php" class="function">IntlTimeZone::createTimeZoneIDEnumeration()</a></span> を参照ください。
   <code class="literal">&quot;GMT+08:30&quot;</code> などのオフセットも指定できます。
  </p>
 </li>
</ul>

    </dd>
   
   
    <dt><code class="parameter">locale</code></dt>
    <dd>
     <p class="para">
      使用するロケール。
      <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> の場合は、
      <a href="intl.configuration.php#ini.intl.default-locale" class="link">デフォルトのロケール</a>
      を使います。
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlcalendar.createinstance-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> のインスタンスを返します。
   失敗時に <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-intlcalendar.createinstance-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
   <p><strong>例1 <span class="function"><strong>IntlCalendar::createInstance()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'intl.default_locale'</span><span style="color: #007700">, </span><span style="color: #DD0000">'es_ES'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'date.timezone'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Europe/Madrid'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$cal </span><span style="color: #007700">= </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">();<br />echo </span><span style="color: #DD0000">"No arguments\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">get_class</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">),<br />        </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">formatObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">));<br />echo </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #DD0000">"Explicit timezone\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$cal </span><span style="color: #007700">= </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">(</span><span style="color: #0000BB">IntlTimeZone</span><span style="color: #007700">::</span><span style="color: #0000BB">getGMT</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">get_class</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">),<br />        </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">formatObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">));<br />echo </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />echo </span><span style="color: #DD0000">"Explicit locale (with calendar)\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$cal </span><span style="color: #007700">= </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">createInstance</span><span style="color: #007700">(</span><span style="color: #0000BB">NULL</span><span style="color: #007700">, </span><span style="color: #DD0000">'es_ES@calendar=persian'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">get_class</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">),<br />        </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">formatObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$cal</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">));</span></span></code></div>
    </div>

    <div class="example-contents"><p>上の例の出力は以下となります。</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">No arguments
string(21) &quot;IntlGregorianCalendar&quot;
string(68) &quot;martes 18 de junio de 2013 14:11:02 Hora de verano de Europa Central&quot;

Explicit timezone
string(21) &quot;IntlGregorianCalendar&quot;
string(45) &quot;martes 18 de junio de 2013 12:11:02 GMT+00:00&quot;

Explicit locale (with calendar)
string(12) &quot;IntlCalendar&quot;
string(70) &quot;martes 28 de Khordad de 1392 14:11:02 Hora de verano de Europa Central&quot;</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-intlcalendar.createinstance-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="intlgregoriancalendar.construct.php" class="methodname" rel="rdfs-seeAlso">IntlGregorianCalendar::__construct()</a> - グレゴリオ暦の Calendar クラスを作成する</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>