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

View: New views
2 Messages — Rating Filter:   Alert me  

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

by Torsten Bühl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Zend_Date 2006-01-01 gives 2005-01-01

by thomasW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No this is not a bug.
Please look into the manual about self defined formats:

http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.selfdefinedformats

There is a own paragraph about this.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


----- Original Message -----
From: "Torsten Bühl" <webmaster@...>
To: <fw-i18n@...>
Sent: Friday, May 09, 2008 4:22 PM
Subject: [fw-i18n] Zend_Date 2006-01-01 gives 2005-01-01


>
> 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
> --
> View this message in context:
> http://www.nabble.com/Zend_Date-2006-01-01-gives-2005-01-01-tp17149090p17149090.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.