note 97724 modified in datetime.construct by danbrown

From: Date: Wed, 05 May 2010 14:17:06 +0000
Subject: note 97724 modified in datetime.construct by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168968@lists.php.net to get a copy of this message
"The $timezone parameter and the current timezone are ignored when the $time parameter […] is a UNIX timestamp." Watch out – this means that these two are NOT equivalent, they result in different timezones (unless your current timezone is GMT): <?php $d = new DateTime(); $d->setTimestamp($t); echo $o->format('O'); // +0200 $d = new DateTime('@' . $t); echo $o->format('O'); // +0000 ?> --was-- "The $timezone parameter and the current timezone are ignored when the $time parameter […] is a UNIX timestamp." Watch out – this means that these two are NOT equivalent, they result in different timezones (unless your current timezone is GMT): $d = new DateTime(); $d->setTimestamp($t); echo $o->format('O'); // +0200 $d = new DateTime('@' . $t); echo $o->format('O'); // +0000 http://php.net/manual/en/datetime.construct.php

« previous php.notes (#168968) next »