<?php
/* - - - - - - - - - - - - - - - - -
Object oriented style
- - - - - - - - - - - - - - - - - */
DateTime public DateTime::setTimestamp ( int $timestamp )
where,
$unixtimestamp = The UNIX timestamp
?>
<?php
/* - - - - - - - - - - - - - - - - -
Procedural style
- - - - - - - - - - - - - - - - - */
DateTime date_timestamp_set ( DateTime $object , int $timestamp )
where,
$object = A DateTime object
$unixtimestamp = The UNIX timestamp
?>
<?php
date_default_timezone_set("UTC");
$dftz011 = date_default_timezone_get();
echo '<br><span class="destaque">' . $dftz011 . '</span><br><br>';
$dtms011 = new DateTime();
$dtms011->setTimestamp(0);
echo $dtms011->format('B => (U) => T Y-M-d H:i:s');
// Beginning of UNIX ERA
?>
<?php
date_default_timezone_set("America/New_York");
$dftz021 = date_default_timezone_get();
echo '<br>' . $dftz021 . '<br><br>';
$dtms021 = date_create();
date_timestamp_set($dtms021, 1234567890);
echo date_format($dtms021, 'B => (U) => T Y-M-d H:i:s');
?>
<?php
date_default_timezone_set("Asia/Tokyo");
$dftz031 = date_default_timezone_get();
echo '<br>' . $dftz031 . '<br><br>';
$dtms031 = date_create();
$ts031 = time();
date_timestamp_set($dtms031, $ts031);
echo date_format($dtms031, 'B => (U) => T Y-M-d H:i:s');
?>