<?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 => 'en',
  ),
  'this' => 
  array (
    0 => 'intlcalendar.todatetime.php',
    1 => 'IntlCalendar::toDateTime',
    2 => 'Convert an IntlCalendar into a DateTime object',
  ),
  'up' => 
  array (
    0 => 'class.intlcalendar.php',
    1 => 'IntlCalendar',
  ),
  'prev' => 
  array (
    0 => 'intlcalendar.settimezone.php',
    1 => 'IntlCalendar::setTimeZone',
  ),
  'next' => 
  array (
    0 => 'class.intlgregoriancalendar.php',
    1 => 'IntlGregorianCalendar',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/intl/intlcalendar/todatetime.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="intlcalendar.todatetime" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlCalendar::toDateTime</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::toDateTime</span> &mdash; <span class="dc-title">Convert an IntlCalendar into a DateTime object</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-intlcalendar.todatetime-description">
  <h3 class="title">Description</h3>
  <p class="para">
   Object-oriented style
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>IntlCalendar::toDateTime</strong></span>(): <span class="type"><span class="type"><a href="class.datetime.php" class="type DateTime">DateTime</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Procedural style
  </p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>intlcal_to_date_time</strong></span>(<span class="methodparam"><span class="type"><a href="class.intlcalendar.php" class="type IntlCalendar">IntlCalendar</a></span> <code class="parameter">$calendar</code></span>): <span class="type"><span class="type"><a href="class.datetime.php" class="type DateTime">DateTime</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Create a <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> object that represents the same
   instant (up to second precision, with a rounding error of less than 1
   second) and has an analog timezone to this object (the difference being
   <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span>ʼs timezone will be backed by PHPʼs timezone
   while <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span>ʼs timezone is backed by ICUʼs).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-intlcalendar.todatetime-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">calendar</code></dt>
    <dd>
     <p class="para">An <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> instance.</p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-intlcalendar.todatetime-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   A <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> object with the same timezone as this
   object (though using PHPʼs database instead of ICUʼs) and the same time,
   except for the smaller precision (second precision instead of millisecond).
   Returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-intlcalendar.todatetime-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
   <p><strong>Example #1 <span class="function"><strong>IntlCalendar::toDateTime()</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">'UTC'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">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">'pt_PT'</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">(</span><span style="color: #DD0000">'Europe/Lisbon'</span><span style="color: #007700">); </span><span style="color: #FF8000">//current time<br /><br /></span><span style="color: #0000BB">$dt </span><span style="color: #007700">= </span><span style="color: #0000BB">$cal</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">toDateTime</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$dt</span><span style="color: #007700">);</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">DateTime Object
(
    [date] =&gt; 2013-07-02 00:29:13
    [timezone_type] =&gt; 3
    [timezone] =&gt; Europe/Lisbon
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-intlcalendar.todatetime-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="intlcalendar.fromdatetime.php" class="methodname" rel="rdfs-seeAlso">IntlCalendar::fromDateTime()</a> - Create an IntlCalendar from a DateTime object or string</span></li>
    <li><span class="methodname"><a href="intlcalendar.gettime.php" class="methodname" rel="rdfs-seeAlso">IntlCalendar::getTime()</a> - Get time currently represented by the object</span></li>
    <li><span class="methodname"><a href="intlcalendar.createinstance.php" class="methodname" rel="rdfs-seeAlso">IntlCalendar::createInstance()</a> - Create a new IntlCalendar</span></li>
    <li><span class="methodname"><a href="datetime.construct.php" class="methodname" rel="rdfs-seeAlso">DateTime::__construct()</a> - Returns new DateTime object</span></li>
   </ul>
  </p>
 </div>


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