#44106 [Opn->Bgs]: date_create with '@'timestamp ignores timezone
| From: | derick@php.net | Date: | Tue, 12 Feb 2008 22:28:38 +0000 |
| Subject: | #44106 [Opn->Bgs]: date_create with '@'timestamp ignores timezone | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-122206@lists.php.net to get a copy of this message | ||
ID: 44106
Updated by: derick@php.net
Reported By: phpbugs at rootcrew dot net
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Linux (Ubuntu/Debian)
PHP Version: 5.3CVS-2008-02-12 (snap)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Using @ with a time stamp, implicitly uses UTC as timezone. The default
timezone or the timezone passed as 2nd argument will only be used if no
TZ is associated with the string. As @ already makes UTC associated with
it, they are ignored.
Previous Comments:
------------------------------------------------------------------------
[2008-02-12 21:35:34] phpbugs at rootcrew dot net
Description:
------------
using "date_create('@'.$timestamp)" ignores the default timezone
setting, giving the timezone as second parameter does not work either.
tested with 5.2.3-1ubuntu6.3, 5.2.0-8+etch10
and tested with snapshot: 5.3-200802121930
Reproduce code:
---------------
$t= time();
$tz= date_default_timezone_get();
$d1= date_create(date("c", $t));
$d2= date_create("@$t"); // ignores default timezone
$d3= date_create("@$t", new DateTimeZone($tz)); // ignores timezone
too
echo "default timezone: $tz\n";
echo $d1->format(DATE_RFC2822)."\n";
echo $d2->format(DATE_RFC2822)."\n";
echo $d3->format(DATE_RFC2822)."\n";
Expected result:
----------------
default timezone: Europe/Berlin
Tue, 12 Feb 2008 22:11:23 +0100
Tue, 12 Feb 2008 22:11:23 +0100
Tue, 12 Feb 2008 22:11:23 +0100
Actual result:
--------------
default timezone: Europe/Berlin
Tue, 12 Feb 2008 22:11:23 +0100
Tue, 12 Feb 2008 21:11:23 +0000
Tue, 12 Feb 2008 21:11:23 +0000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44106&edit=1