Edit report at https://bugs.php.net/bug.php?id=55272&edit=1

 ID:                 55272
 Comment by:         anon at anon dot com
 Reported by:        steve at stringersites dot com
 Summary:            Missing semicolon in DATE_ISO8601 Predefined
                     Constant for date()
 Status:             Bogus
 Type:               Bug
 Package:            Date/time related
 Operating System:   Mac OS X
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

This is a semi-colon -- ;
This is a colon -- :


Previous Comments:
------------------------------------------------------------------------
[2011-07-25 17:28:24] steve at stringersites dot com

Got it.  

Note that the Google Checkout XML API rejects the semicolon-less timestamp 
using 
the predefined constant. The only format it accepts is "Y-m-d\TH:i:sP".

Not that you're responsible for what Google does, but it's something to think 
about where the theoretical and practical collide.

------------------------------------------------------------------------
[2011-07-25 16:38:00] ahar...@php.net

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.

------------------------------------------------------------------------
[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

Reply via email to