I would like to compute the difference in days between two dates. I have the
fix_dst option set to true and the timezone is America/New York. A DST
change happened in my timezone on March 9, 2008. So,

$date1 = new Zend_Date(array(
     'year'=> 2008,
    'month'=>3,
    'day'=>7,
    'hour'=>12,
));

$date2 = new Zend_Date(array(
    'year'=> 2008,
     'month'=>3,
    'day'=>10,
    'hour'=>12,
));

$diff = $date2->sub($date1);
print " difference in days is ".$diff/86400;

And the output is not what I want to hear, i.e., not 3 but 2.9583333333333

I think I understand, Zend_Date is telling me how many seconds actually
elapsed between the two dates. But I want to figure out the days, accounting
for the fact that one of the intervening days had only 23 hours. What's the
correct approach?

Thanks.

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness

Reply via email to