Zend Framework

Zend_Date::toString('ddMMYY') showing wrong year (+1)

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not an Issue
  • Affects Version/s: 1.5.0
  • Fix Version/s: 1.5.1
  • Component/s: Zend_Date
  • Labels:
    None

Description

$date1 = new Zend_Date('301207', 'ddMMYY');
echo $date1->toString('ddMMYY');
echo $date1;

$date2 = new Zend_Date('311207', 'ddMMYY');
echo $date2->toString('ddMMYY');
echo $date2;

301207
30 Dec 2007 00:00:00

311208 // + 1 year
31 Dec 2007 00:00:00

It looks like the date was parsed correctly and it's stored internally with the right year but when I display it the year jumps to 2008

Activity

Hide
Thomas Weidner added a comment -

See into the manual http://framework.zend.com/manual/en/zend.date.constants.html
There is a note after the section about using self defined ISO formats and often made mistakes due to wrong format tokens.

Instead of the ISO-year token you should use the real year token.
So just change "Y" to "y" and that's it.

Show
Thomas Weidner added a comment - See into the manual http://framework.zend.com/manual/en/zend.date.constants.html There is a note after the section about using self defined ISO formats and often made mistakes due to wrong format tokens. Instead of the ISO-year token you should use the real year token. So just change "Y" to "y" and that's it.
Hide
Wil Sinclair added a comment -

I'm assuming this fix is merged to the 1.5 release branch for release with 1.5.1. Please update JIRA if this is not the case.

Show
Wil Sinclair added a comment - I'm assuming this fix is merged to the 1.5 release branch for release with 1.5.1. Please update JIRA if this is not the case.
Hide
Thomas Weidner added a comment -

This issue is not an issue... there is no change and also no fix

Show
Thomas Weidner added a comment - This issue is not an issue... there is no change and also no fix

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: