Out of curiosity... why do you want to have YEAR - MINUTE - DAY as date ???

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

----- Original Message ----- From: "nisanth" <[email protected]>
To: <[email protected]>
Sent: Thursday, March 25, 2010 8:59 AM
Subject: [fw-general] Difference between days using zend



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
--
View this message in context: http://n4.nabble.com/Difference-between-days-using-zend-tp1690273p1690273.html
Sent from the Zend Framework mailing list archive at Nabble.com.


Reply via email to