ZF-3982: Some dates are not possible with Zend_Date


Hi dear,

I try to set specific dates in a Zend_Date object but I got another date :

Code :

$dayDate = Zend_Date::now(); $dayDate->setYear(2008); $dayDate->setMonth(12); $dayDate->setDay(29); echo $dayDate->toString('dd/MM/YYYY');

This give me : 29/12/2009 and not 29/12/2009

The problem appears with some date (ex: 31/12/2007, ...)

Thanks for your feedback

--Edit on 2008-08-18 The problem seems to come from toString() function. toArray() function returns right values;


Please look into the documentation for the proper usage of the date constants. 'YYYY' is not the real year... it's the ISO Year used for calendar representations. The result is correct. For real year use 'yyyy' as described in the manual. There is an extra paragraph about the difference between 'Y' and 'y'.

Duplication of ZF-3724