note 99980 deleted from datetime.settimestamp by danbrown
| From: | danbrown@php.net | Date: | Fri, 17 Sep 2010 16:22:57 +0000 |
| Subject: | note 99980 deleted from datetime.settimestamp by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172696@lists.php.net to get a copy of this message | ||
Note Submitter: fokeyjoe at gmail dot com
----
As pointed out by Use Web Form at Aouie.net, the example in the notes does not work exactly like
setTimestamp. A corrected alternative is at http://gist.github.com/349273, synopsis of this is:
$dateObj = new DateTime();
$dateObj->setDate(date('Y', $unixtimestamp), date('n', $unixtimestamp),
date('d', $unixtimestamp));
$dateObj->setTime(date('G', $unixtimestamp), date('i', $unixtimestamp),
date('s', $unixtimestamp));