note 118796 deleted from datetime.settimezone by cmb
| From: | cmb@php.net | Date: | Thu, 18 Feb 2016 11:39:01 +0000 |
| Subject: | note 118796 deleted from datetime.settimezone by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204981@lists.php.net to get a copy of this message | ||
Note Submitter: balbuf
----
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. I'm
not sure if this is expected behavior, but it is not what I would expect. In any case, other output
values from format() seem to be accurate, and the true timestamp is still accessible via
getTimestamp().