Bug #55272 [Opn->Bgs]: Missing semicolon in DATE_ISO8601 Predefined Constant for date()
Edit report at https://bugs.php.net/bug.php?id=55272&edit=1
ID: 55272
Updated by: aharvey@php.net
Reported by: steve at stringersites dot com
Summary: Missing semicolon in DATE_ISO8601 Predefined
Constant for date()
-Status: Open
+Status: Bogus
Type: Bug
-Package: Unknown/Other Function
+Package: Date/time related
Operating System: Mac OS X
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
ISO 8601 explicitly allows time zone representations to be "basic" (without the
colon), or "extended" (with the colon). Both are equally valid, and PHP implements
the former in that particular constant.
Previous Comments:
------------------------------------------------------------------------
[2011-07-23 20:39:42] steve at stringersites dot com
Description:
------------
It would appear that there is a mistake in the DATE_ISO8601 predefined constant
for the date() function.
current output: 2011-07-22T00:00:00-0500
desired output: 2011-07-22T00:00:00-05:00
http://www.php.net/manual/en/class.datetime.php#datetime.constants.iso8601
http://en.wikipedia.org/wiki/ISO_8601
Test script:
---------------
As best as I can tell, there's supposed to be a semicolon between the timezone offset
hours:minutes.
<?php
$d = mktime (0, 0, 0, '03', '08', '2011');
// 2011-03-08T00:00:00-0600 <-- actual, incorrect (?) result
echo date(DATE_ISO8601, $d).'<br>';
// 2011-03-08T00:00:00-0600
echo date("Y-m-d\TH:i:sO", $d).'<br>';
// 2011-03-08T00:00:00-06:00 <-- expected result
echo date("Y-m-d\TH:i:sP", $d).'<br>';
?>
So the format for DATE_ISO8601 should be "Y-m-d\TH:i:sP" (capital P at the end), not
"Y-m-d\TH:i:sO" (capital O at the end).
Expected result:
----------------
// 2011-03-08T00:00:00-0600 <-- actual, incorrect (?) result
echo date(DATE_ISO8601, $d);
Actual result:
--------------
// 2011-03-08T00:00:00-06:00 <-- expected result
echo date("Y-m-d\TH:i:sP", $d);
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55272&edit=1
Thread (4 messages)