note 118797 added to datetime.settimezone

From: Date: Sun, 07 Feb 2016 19:44:08 +0000
Subject: note 118797 added to datetime.settimezone
Groups: php.notes 
Request: Send a blank email to php-notes+get-204894@lists.php.net to get a copy of this message
This is a revised note with additional information: It appears that what forzi at mail333 dot com said is correct. When you reset the timezone on a DateTime object using a timezone that was instantiated with a GMT offset (e.g. <?php new DateTimeZone('-0500'); ?>) the timestamp as reported by <?php $dt->format('U'); ?> changes. However, the value reported by <?php $dt->getTimestamp(); ?> does _not_ change. Interestingly, once <?php $dt->getTimestamp(); is called, the value from <?php $dt->format('U'); ?> starts returning the correct timestamp. This appears to be a bug. In any case, other output values from format() seem to be accurate, and the true timestamp is always accessible via getTimestamp(). ---- Server IP: 72.52.91.14 Probable Submitter: 72.195.139.26 ---- Manual Page -- http://php.net/manual/en/datetime.settimezone.php Edit -- https://master.php.net/note/edit/118797 Del: integrated -- https://master.php.net/note/delete/118797/integrated Del: useless -- https://master.php.net/note/delete/118797/useless Del: bad code -- https://master.php.net/note/delete/118797/bad+code Del: spam -- https://master.php.net/note/delete/118797/spam Del: non-english -- https://master.php.net/note/delete/118797/non-english Del: in docs -- https://master.php.net/note/delete/118797/in+docs Del: other reasons-- https://master.php.net/note/delete/118797 Reject -- https://master.php.net/note/reject/118797 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204894) next »