Bug #60453 [Asn->Nab]: ISO Format sets invalid timezone: Z
| From: | derick@php.net | Date: | Tue, 20 Jan 2015 21:21:58 +0000 |
| Subject: | Bug #60453 [Asn->Nab]: ISO Format sets invalid timezone: Z | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190088@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60453&edit=1
ID: 60453
Updated by: derick@php.net
Reported by: ale at alejandrolapeyre dot com dot ar
Summary: ISO Format sets invalid timezone: Z
-Status: Assigned
+Status: Not a bug
Type: Bug
Package: Date/time related
PHP Version: 5.3.8
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP --
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
Timezone "Z" is the same as "UTC", so it's not really wrong. Newer versions
of PHP do support (PHP 5.6 at least):
$dt = new DateTimeZone("Z");
Previous Comments:
------------------------------------------------------------------------
[2011-12-06 23:03:46] ale at alejandrolapeyre dot com dot ar
Description:
------------
---
From manual page: http://www.php.net/datetime.construct#refsect1-datetime.construct-description
---
Creating a DateTime from a string in the ISO8601 format "2011-12-06T19:55:34Z" will
succeed, but with a DateTimeZone with name "Z". That is incorrect, since "Z" is
the way to specify UTC in that ISO format.
Furthermore, if you want to create a DateTimeZone("Z") it will throw.
Best regards, hope this helps to make php better :)
Test script:
---------------
$dt = new DateTime("2011-12-06T19:55:34Z");
$tz = $dt->getTimeZone();
echo $tz->getName();
Expected result:
----------------
"UTC"
Actual result:
--------------
"Z"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60453&edit=1