<?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.settimestamp.php',
    1 => 'DateTimeImmutable::setTimestamp',
    2 => 'Sets the date and time based on a Unix timestamp',
  ),
  'up' => 
  array (
    0 => 'class.datetimeimmutable.php',
    1 => 'DateTimeImmutable',
  ),
  'prev' => 
  array (
    0 => 'datetimeimmutable.settime.php',
    1 => 'DateTimeImmutable::setTime',
  ),
  'next' => 
  array (
    0 => 'datetimeimmutable.settimezone.php',
    1 => 'DateTimeImmutable::setTimezone',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/datetime/datetimeimmutable/settimestamp.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="datetimeimmutable.settimestamp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DateTimeImmutable::setTimestamp</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DateTimeImmutable::setTimestamp</span> &mdash; <span class="dc-title">Sets the date and time based on a Unix timestamp</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-datetimeimmutable.settimestamp-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::setTimestamp</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$timestamp</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 <span class="type"><a href="class.datetimeimmutable.php" class="type DateTimeImmutable">DateTimeImmutable</a></span> object constructed from the
   old one, with the date and time set based on an Unix timestamp.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-datetimeimmutable.settimestamp-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">timestamp</code></dt>
    <dd>
     <p class="para">
      Unix timestamp representing the date.
      Setting timestamps outside the range of <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> is possible by using
      <span class="methodname"><a href="datetimeimmutable.modify.php" class="methodname">DateTimeImmutable::modify()</a></span> with the <code class="literal">@</code> format.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-datetimeimmutable.settimestamp-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Повертає новий об&#039;єкт <span class="classname"><a href="class.datetimeimmutable.php" class="classname">DateTimeImmutable</a></span> зі зміненими даними.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-datetimeimmutable.settimestamp-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="example-1">
   <p><strong>Приклад #1 <span class="function"><strong>DateTimeImmutable::setTimestamp()</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">();<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">'U = Y-m-d H:i:s'</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">setTimestamp</span><span style="color: #007700">(</span><span style="color: #0000BB">1171502725</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">'U = Y-m-d H:i:s'</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">1272508903 = 2010-04-28 22:41:43
1171502725 = 2007-02-14 20:25:25</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-datetimeimmutable.settimestamp-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="datetime.gettimestamp.php" class="function" rel="rdfs-seeAlso">DateTimeImmutable::getTimestamp()</a> - Gets the Unix timestamp</span></li>
  </ul>
 </div>



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