#43527 [Asn->Csd]: DateTime created from a timestamp reports environment timezone
| From: | derick@php.net | Date: | Thu, 17 Jan 2008 18:52:04 +0000 |
| Subject: | #43527 [Asn->Csd]: DateTime created from a timestamp reports environment timezone | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121367@lists.php.net to get a copy of this message | ||
ID: 43527
Updated by: derick@php.net
Reported By: mattis at xait dot no
-Status: Assigned
+Status: Closed
Bug Type: Date/time related
Operating System: Windows XP SP2
PHP Version: 5.2.5
Assigned To: derick
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
The script now returns:
+10:00
(And you really should not be using the "Etc/*" style timezone
identifiers.
Previous Comments:
------------------------------------------------------------------------
[2007-12-07 09:59:22] derick@php.net
There is a bug here, but the expected result is not necessarily what
you say it should be. Because there is no real timezone , it probably
should return false.
------------------------------------------------------------------------
[2007-12-07 09:55:51] mattis at xait dot no
Description:
------------
When creating a DateTime from a timestamp (i.e. date('r)) it will
report the TimeZone of the environment it was created in and not the
timezone in the timestamp.
Reproduce code:
---------------
<?php
date_default_timezone_set("Etc/GMT+1");
$datetime = new DateTime('Fri, 07 Dec 2007 19:05:14 +1000');
echo $datetime->getTimezone()->getName(), "\n";
Expected result:
----------------
Etc/GMT-10
Actual result:
--------------
Etc/GMT+1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43527&edit=1