Zend Framework

Zend_Date outputs wrong year

Details

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

Description

Try this code:

$date = new Zend_Date();
$date->set($from, Zend_Date::TIMESTAMP);

//$from is dynamically passed timestamp

Zend_Debug::dump($from);
Zend_Debug::dump(date('Y-m-d H:i:s', $from)); 
Zend_Debug::dump($date->get(Dnez_Date::DB_DATETIME));
exit();

//source of Dnez_Date class

class Dnez_Date extends Zend_Date
{

    const DB_DATE = 'YYYY-MM-dd';
    const DB_DATETIME = 'YYYY-MM-dd HH:mm:ss';

}

The result is:

int 1262296800
string '2010-01-01 00:00:00' (length=19)
string '2009-01-01 00:00:00' (length=19)

For some reason Zend_Date give me wrong year.

p.s. I just downloaded the latest trunk version of framework.

Issue Links

Activity

Hide
Dolf Schimmel (Freeaqingme) added a comment -

Please see the documentation on what your problem is (hint: Y vs y).

Show
Dolf Schimmel (Freeaqingme) added a comment - Please see the documentation on what your problem is (hint: Y vs y).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: