I am trying to get the difference between two dates in days, but am having trouble (for example, it reports 337 days between December 23, 2009 and December 25, 2009). I am following an example put up by Thomas about a year ago:
http://old.nabble.com/Re%3A-Zend_Date-arithmetic%3A-difference-in-days-%28not-seconds%29-between-two-dates-p20085144.html Here is some example code: $today = new Zend_Date('12/23/2009', 'MM/dd/yyyy'); $xmas = new Zend_Date('12/25/2009', 'MM/dd/yyyy'); var_dump($today->getIso()); var_dump($xmas->getIso()); $dateDiff = $xmas->subDate($today); var_dump($dateDiff->getIso()); var_dump($dateDiff->get(Zend_Date::DAY_OF_YEAR) - 1); Here is the output: string '2009-12-23T00:00:00-06:00' (length=25) string '2009-12-25T00:00:00-06:00' (length=25) string '-1-12-05T00:00:00-0600' (length=22) int 337 -- View this message in context: http://old.nabble.com/Difficulty-getting-difference-between-two-Zend_Date-objects-tp26408426p26408426.html Sent from the Zend Framework mailing list archive at Nabble.com.
