« Return to Thread: Zend_Date 2006-01-01 gives 2005-01-01

Zend_Date 2006-01-01 gives 2005-01-01

by Torsten Bühl :: Rate this Message:

Reply to Author | View in Thread

I paste my code here, is it a Bug?
In the Bootstrap I have:
setlocale(LC_ALL, 'de_DE.UTF8');
date_default_timezone_set("Europe/Berlin");

the script is:

$Date = new Zend_Date();
$Date->set("2006-01-01");
echo $Date->get('dd.MM.YYYY');
//gives: 01.01.2005 <- FAIL
//expected: 01.01.2006

$Date = new Zend_Date();
$Date->set("2005-01-01");
echo $Date->get('dd.MM.YYYY');
//gives: 01.01.2004 <- FAIL
//expected: 01.01.2005

$Date = new Zend_Date();
$Date->set("2004-01-01");
echo $Date->get('dd.MM.YYYY');
//gives: 01.01.2004 <- OK
//expected: 01.01.2004

To test something else I also have:

$datestr = "2006-01-01";
$date = strtotime($datestr);
echo date("Y-m-d",$date);
//gives: 2006-01-01 <- OK
//expected: 2006-01-01

Tanks for reply
Best, Torsten

 « Return to Thread: Zend_Date 2006-01-01 gives 2005-01-01