DateTime created from a timestamp reports environment timezone
| Bug #43527 | DateTime created from a timestamp reports environment timezone | ||||
|---|---|---|---|---|---|
| Submitted: | 2007-12-07 09:55 UTC | Modified: | 2008-01-17 18:52 UTC | ||
| From: | mattis at xait dot no | Assigned: | derick (profile) | ||
| Status: | Closed | Package: | Date/time related | ||
| PHP Version: | 5.2.5 | OS: | Windows XP SP2 | ||
| Private report: | No | CVE-ID: | None | ||
[2007-12-07 09:55 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2007-12-07 09:59 UTC] derick@php.net
[2008-01-17 18:52 UTC] derick@php.net