Issues

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

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

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/…

According to ISO +05, +05:00 and +0500 are valid timezones. See http://dotat.at/tmp/ISO_8601-2004_E.pdf, 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.