1

Zend_Date function returns the value "Feb 10, 2012" . It supposed to return "Oct 2, 2012". If a give the day greater than 12 than it returns the currect output. I don't know what I was missing. Please help me.

Thanks

user1559230
  • 2,790
  • 5
  • 26
  • 32

2 Answers2

1

If your format is YYYY-MM-DD (2012-10-02), try this code:

$str  = '2012-10-02';
$date = new Zend_Date($str, Zend_Date::YEAR . '-' . Zend_Date::MONTH . '-' . Zend_Date::DAY);
echo $date->toString();
Alex Pliutau
  • 21,392
  • 27
  • 113
  • 143
0

What is the code you are using to call the function?

Different countries use different date formats. Some use dd/mm/yyyy others use mm/dd/yyyy. The order you are passing in the day and month are different from the way the function expects to be called.

Try reversing the month and day before you call the function.

Luke Mills
  • 1,616
  • 1
  • 11
  • 18