Take a look at Zend Framework's date format definitions:
http://framework.zend.com/manual/en/zend.locale.date.datesandtimes.html#zend.locale.date.normalize

I think it would work if you use 'yyyy-MM-dd' instead of 'YYYY-mm-dd';

El mié, 24-03-2010 a las 23:59 -0800, nisanth escribió:
> Hi All,
> I have the below line of codes 
> 
>     $day1 = new Zend_Date('2010-03-01', 'YYYY-mm-dd');
>     $day2 = new Zend_Date('2010-03-05', 'YYYY-mm-dd');
>     $dateDiff = $day2->getDate()->get(Zend_Date::TIMESTAMP) -
> $day1->getDate()->get(Zend_Date::TIMESTAMP);
>     $days = floor((($dateDiff / 60) / 60) / 24);
>     return  $days;  
> 
> this will return 4
> 
> But if gave 
> 
>     $day1 = new Zend_Date('2010-02-28', 'YYYY-mm-dd');
>     $day2 = new Zend_Date('2010-03-01', 'YYYY-mm-dd');
>     $dateDiff = $day2->getDate()->get(Zend_Date::TIMESTAMP) -
> $day1->getDate()->get(Zend_Date::TIMESTAMP);
>     $days = floor((($dateDiff / 60) / 60) / 24);
>     return  $days; 
> 
> it will return -27 .. how will i get right answer

-- 
Alayn Gortazar
Irontec, Internet y Sistemas sobre GNU/LinuX - http://www.irontec.com
+34 94.404.81.82


Reply via email to