ZF-10492: Incorrect date output (year 2041) using specific timezones
Description
Creating a Zend_Date object based on a string (format "yyyy-MM-dd HH:mm:ss") including a year like 2041 and using specific timezones, generates a wrong date output.
Here is the code : $t = '2041-08-01 00:00:00'; $zd = new Zend_Date($t, 'yyyy-MM-dd HH:mm:ss'); echo $zd;
Expected output: "1 août 2041 00:00:00" Output: "1 août 2041 01:00:00"
The bug may be reproduced using timezone "Europe/Brussels", "America/New_York", and others probably. There is no error when using e.g. "Europe/Berlin" timezone.
There is no error using DateTime classes in PHP. Code comparing ZF Zend_Date class output with PHP DateTime class below:
$t = '2041-08-01 00:00:00';
//Try in DateTime
$dt = new DateTime($t);
echo $dt->format('Y-m-d H:i:s') . "
";
//Try with Zend_Date
$zd = new Zend_Date($t, 'yyyy-MM-dd HH:mm:ss');
echo $zd . "
";
I asked other people to test it on IRC #zftalk, and they also may reproduce the bug.
Comments
Posted by Shawn Stratton (mfacenet) on 2010-09-23T07:30:45.000+0000
I believe this is one of Thomas's components.
Posted by Ryan Mauger (bittarman) on 2010-09-23T08:09:43.000+0000
Setting component
Posted by Shawn Stratton (mfacenet) on 2011-04-30T03:45:19.000+0000
This was likely fixed by a similar ticket, cannot reproduce.
Posted by Thomas Weidner (thomas) on 2011-05-01T07:12:10.000+0000
Reopening issue: Needs to be verified and added as test Assigned to component author