date duration fail to calculate

Hi Everyone,

I was very sad after a long way but still cannot figure out the duration between two date.

$date1="20090812 23:48:56";
$date2="20090813 00:01:37";

The output will be "001241".

I did the following tries, like print localtime(UnixDate(ParseDate("20090812 23:48:56"),"%s")); and other ways to calculate the differience, but :--(

Please advice. Thanks:confused:

A quick search produced: http://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html

Below is the finally code, hope this is the most simple method.
i have two date, i want to get the duration in to hhmmss format. Below is the working code.

$a = localtime(UnixDate(ParseDate("20090823 08:03:35"),"%s"));
$b = localtime(UnixDate(ParseDate("20090823 12:04:55"),"%s"));
$c = str2time($b)-str2time($a);
$hms=sprintf("%02d%02d%02d",int($c/3600),int($c%3600/60),int($c%60));
print $hms;