ZF-11278: Problem with Zend_Date and a valid ISO_8601 - Timestamp given in the construct


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


+05 is no valid timezone. Therefor this characters are ignored and the servers timezone is used.

But if you look at…, then you see, that the timestamp 2010-02-02T20:10:00+05 is also a valid ISO8601-Timestamp.


If you wonder, why i am getting this format, you can install postgresql, and you see this timestamp as output of a sql-select.…

According to ISO +05, +05:00 and +0500 are valid timezones. See, page 18

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.

You have to look at ISO8601 not ISO8160. If you open the posted links, you would see what you need.

Sorry for the wrong title of the Issue, i have fixed the title now.