#43527 [Opn->Asn]: DateTime created from a timestamp reports environment timezone
| From: | derick@php.net | Date: | Fri, 07 Dec 2007 09:59:22 +0000 |
| Subject: | #43527 [Opn->Asn]: DateTime created from a timestamp reports environment timezone | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120448@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: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Windows XP SP2
PHP Version: 5.2.5
-Assigned To:
+Assigned To: derick
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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