note 93821 added to datetime.settimestamp
| From: | edwin dot h at clear dot net dot nz | Date: | Thu, 01 Oct 2009 08:55:55 +0000 |
| Subject: | note 93821 added to datetime.settimestamp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161197@lists.php.net to get a copy of this message | ||
If you are using PHP < 5.3.0 you can use this function instead:
<?php
function DateTime_setTimestamp(&$dt,$timestamp) {
$dtz_original = $dt -> getTimezone();
$dtz_utc = new DateTimeZone("UTC");
$dt -> setTimezone($dtz_utc);
$year = gmdate("Y",$timestamp);
$month = gmdate("n",$timestamp);
$day = gmdate("j",$timestamp);
$hour = gmdate("G",$timestamp);
$minute = gmdate("i",$timestamp);
$second = gmdate("s",$timestamp);
$dt -> setDate($year,$month,$day);
$dt -> setTime($hour,$minute,$second);
$dt -> setTimezone($dtz_original);
}
?>
----
Server IP: 202.89.58.1
Probable Submitter: 203.97.222.211
----
Manual Page -- http://www.php.net/manual/en/datetime.settimestamp.php
Edit -- https://master.php.net/note/edit/93821
Del: integrated -- https://master.php.net/note/delete/93821/integrated
Del: useless -- https://master.php.net/note/delete/93821/useless
Del: bad code -- https://master.php.net/note/delete/93821/bad+code
Del: spam -- https://master.php.net/note/delete/93821/spam
Del: non-english -- https://master.php.net/note/delete/93821/non-english
Del: in docs -- https://master.php.net/note/delete/93821/in+docs
Del: other reasons-- https://master.php.net/note/delete/93821
Reject -- https://master.php.net/note/reject/93821
Search -- https://master.php.net/manage/user-notes.php