ZF-11278: Problem with Zend_Date and a valid ISO_8601 - Timestamp given in the construct
Description
If you give a valid Timestamp, which looks like that: 2010-02-02T20:10:00+01 instead of that 2010-02-02T20:10:00+05:00 you get the wrong Timestamp back grom the Zend_Date - Construct.
See example below:
CODE: $date1 = new Zend_Date( '2010-02-02T20:10:00', Zend_Date::ISO_8601 ); $date2 = new Zend_Date( '2010-02-02T20:10:00+05', Zend_Date::ISO_8601 ); $date3 = new Zend_Date( '2010-02-02T20:10:00+05:00', Zend_Date::ISO_8601 ); echo $date1->getIso() . "\n"; echo $date2->getIso() . "\n"; echo $date3->getIso() . "\n";
OUTPUT: 2010-02-02T20:10:00+01:00 2010-02-02T20:10:00+01:00 2010-02-02T20:10:00+05:00
Expected Output: 2010-02-02T20:10:00+01:00 2010-02-02T20:10:00+05:00 2010-02-02T20:10:00+05:00
Comments
Posted by Thomas Weidner (thomas) on 2011-04-16T21:49:29.000+0000
+05 is no valid timezone. Therefor this characters are ignored and the servers timezone is used.
Posted by Erdbeer Gulasch (erdbeergulasch) on 2011-04-18T09:21:16.000+0000
But if you look at http://en.wikipedia.org/wiki/ISO_8601/…, then you see, that the timestamp 2010-02-02T20:10:00+05 is also a valid ISO8601-Timestamp.
±hh
If you wonder, why i am getting this format, you can install postgresql, and you see this timestamp as output of a sql-select.
http://postgresql.org/docs/8.4/…
Posted by Andrey Shevchenko (distdev) on 2011-04-28T12:36:31.000+0000
According to ISO +05, +05:00 and +0500 are valid timezones. See http://dotat.at/tmp/ISO_8601-2004_E.pdf, page 18
Posted by Thomas Weidner (thomas) on 2011-07-30T21:17:12.000+0000
Please note that ISO 8160 is about textiles. Zend_Date will never take care about the production process of textured filament yarns which is described by this ISO norm.
Posted by Erdbeer Gulasch (erdbeergulasch) on 2012-01-13T10:45:58.000+0000
You have to look at ISO8601 not ISO8160. If you open the posted links, you would see what you need.
Posted by Erdbeer Gulasch (erdbeergulasch) on 2012-01-13T10:52:04.000+0000
Sorry for the wrong title of the Issue, i have fixed the title now.