how to calculate difference between two dates

a=02-08-2009 or 2009-08-02

b=03-08-2009 or 2009-08-03

when subtracting it i should get the answer as 1…do someone tell me



$diff = strtotime("2009-08-03") - strtotime("2009-08-02");


$days = $diff / 60 / 60 / 24


yes thanks i got it

how to subtract between two different times

12.00.00 - 03.30.00

please help me


$from = strtotime("2012-09-12 12:00:00");

$to = strtotime("2012-09-13 03:30:00");

$diff = round(abs($to - $from) / 60, 2);