<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.datetimeimmutable.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'datetimeimmutable.settimezone.php',
    1 => 'DateTimeImmutable::setTimezone',
    2 => 'Sets the time zone',
  ),
  'up' => 
  array (
    0 => 'class.datetimeimmutable.php',
    1 => 'DateTimeImmutable',
  ),
  'prev' => 
  array (
    0 => 'datetimeimmutable.settimestamp.php',
    1 => 'DateTimeImmutable::setTimestamp',
  ),
  'next' => 
  array (
    0 => 'datetimeimmutable.sub.php',
    1 => 'DateTimeImmutable::sub',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/datetime/datetimeimmutable/settimezone.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="datetimeimmutable.settimezone" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DateTimeImmutable::setTimezone</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DateTimeImmutable::setTimezone</span> &mdash; <span class="dc-title">Sets the time zone</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-datetimeimmutable.settimezone-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="attribute">#[\NoDiscard]</span><br>
   <span class="modifier">public</span> <span class="methodname"><strong>DateTimeImmutable::setTimezone</strong></span>(<span class="methodparam"><span class="type"><a href="class.datetimezone.php" class="type DateTimeZone">DateTimeZone</a></span> <code class="parameter">$timezone</code></span>): <span class="type"><a href="class.datetimeimmutable.php" class="type DateTimeImmutable">DateTimeImmutable</a></span></div>

  <p class="para rdfs-comment">
   Returns a new DateTimeImmutable object with a new timezone set.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-datetimeimmutable.settimezone-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">timezone</code></dt>
    <dd>
     <p class="para">
      A <span class="classname"><a href="class.datetimezone.php" class="classname">DateTimeZone</a></span> object representing the
      desired time zone.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-datetimeimmutable.settimezone-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns a new modified <span class="classname"><a href="class.datetimeimmutable.php" class="classname">DateTimeImmutable</a></span> object for
   method chaining. The underlaying point-in-time is not changed when calling
   this method.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-datetimeimmutable.settimezone-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="function"><strong>DateTimeImmutable::setTimeZone()</strong></span> example</strong></p>
   <div class="example-contents"><p>Об&#039;єктно-орієнтований стиль</p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$date </span><span style="color: #007700">= new </span><span style="color: #0000BB">DateTimeImmutable</span><span style="color: #007700">(</span><span style="color: #DD0000">'2000-01-01'</span><span style="color: #007700">, new </span><span style="color: #0000BB">DateTimeZone</span><span style="color: #007700">(</span><span style="color: #DD0000">'Pacific/Nauru'</span><span style="color: #007700">));<br />echo </span><span style="color: #0000BB">$date</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #DD0000">'Y-m-d H:i:sP'</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$newDate </span><span style="color: #007700">= </span><span style="color: #0000BB">$date</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setTimezone</span><span style="color: #007700">(new </span><span style="color: #0000BB">DateTimeZone</span><span style="color: #007700">(</span><span style="color: #DD0000">'Pacific/Chatham'</span><span style="color: #007700">));<br />echo </span><span style="color: #0000BB">$newDate</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #DD0000">'Y-m-d H:i:sP'</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Поданий вище приклад
виведе:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">2000-01-01 00:00:00+12:00
2000-01-01 01:45:00+13:45</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-datetimeimmutable.settimezone-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="datetime.gettimezone.php" class="function" rel="rdfs-seeAlso">DateTimeImmutable::getTimezone()</a> - Return time zone relative to given DateTime</span></li>
   <li><span class="function"><a href="datetimezone.construct.php" class="function" rel="rdfs-seeAlso">DateTimeZone::__construct()</a> - Creates new DateTimeZone object</span></li>
  </ul>
 </div>



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