Bug #55272 [Opn->Bgs]: Missing semicolon in DATE_ISO8601 Predefined Constant for date()

From: Date: Mon, 25 Jul 2011 16:38:00 +0000
Subject: Bug #55272 [Opn->Bgs]: Missing semicolon in DATE_ISO8601 Predefined Constant for date()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-162161@lists.php.net to get a copy of this message
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)

« previous php.bugs (#162161) next »