<?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 => 'uk',
  ),
  'this' => 
  array (
    0 => 'intlcalendar.fromdatetime.php',
    1 => 'IntlCalendar::fromDateTime',
    2 => 'Create an IntlCalendar from a DateTime object or string',
  ),
  'up' => 
  array (
    0 => 'class.intlcalendar.php',
    1 => 'IntlCalendar',
  ),
  'prev' => 
  array (
    0 => 'intlcalendar.fielddifference.php',
    1 => 'IntlCalendar::fieldDifference',
  ),
  'next' => 
  array (
    0 => 'intlcalendar.get.php',
    1 => 'IntlCalendar::get',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/intl/intlcalendar/fromdatetime.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="intlcalendar.fromdatetime" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlCalendar::fromDateTime</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8, PECL &gt;= 3.0.0a2)</p><p class="refpurpose"><span class="refname">IntlCalendar::fromDateTime</span> &mdash; <span class="dc-title">Create an IntlCalendar from a DateTime object or string</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlcalendar.fromdatetime-description">
  <h3 class="title">Опис</h3>
  <p class="para">
   Об&#039;єктно-орієнтований стиль
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>IntlCalendar::fromDateTime</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.datetime.php" class="type DateTime">DateTime</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$datetime</code></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_from_date_time</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.datetime.php" class="type DateTime">DateTime</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$datetime</code></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">
   Creates an <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> object either from a
   <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> object or from a string from which a
   <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> object can be built.
  </p>
  <p class="para">
   The new calendar will represent not only the same instant as the
   given <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> (subject to precision loss for dates
   very far into the past or future), but also the same timezone (subject to
   the caveat that different timezone databases will be used, and therefore
   the results may differ).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-intlcalendar.fromdatetime-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">datetime</code></dt>
    <dd>
     <p class="para">
      A <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> object or a <span class="type"><a href="language.types.string.php" class="type string">string</a></span> that
      can be passed to <span class="function"><a href="datetime.construct.php" class="function">DateTime::__construct()</a></span>.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlcalendar.fromdatetime-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   The created <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> object or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> in case of
   failure. If a <span class="type"><a href="language.types.string.php" class="type string">string</a></span> is passed, any exception that occurs
   inside the <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> constructor is propagated.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-intlcalendar.fromdatetime-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="function"><strong>IntlCalendar::fromDateTime()</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">'date.timezone'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Europe/Lisbon'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//same as IntlCalendar::fromDateTime(new DateTime(...))<br /></span><span style="color: #0000BB">$cal1 </span><span style="color: #007700">= </span><span style="color: #0000BB">IntlCalendar</span><span style="color: #007700">::</span><span style="color: #0000BB">fromDateTime</span><span style="color: #007700">(</span><span style="color: #DD0000">'2013-02-28 00:01:02 Europe/Berlin'</span><span style="color: #007700">, </span><span style="color: #DD0000">'de_DE'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//Note the timezone is Europe/Berlin, not the default Europe/Lisbon<br /></span><span style="color: #007700">echo </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">$cal1</span><span style="color: #007700">, </span><span style="color: #DD0000">'yyyy MMMM d HH:mm:ss VVVV'</span><span style="color: #007700">, </span><span style="color: #DD0000">'de_DE'</span><span style="color: #007700">), </span><span style="color: #DD0000">"\n"</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">2013 Februar 28 00:01:02 Deutschland Zeit</pre>
</div>
    </div>
   </div>
  </p>
 </div>


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