$endTime='2004-05-17 04:00:01';
$startTime='2004-05-16 22:58:15';
function timediff($startTime,$endTime){
//you can modify what the function returns
global $timediff; //global array if you need it
$a = strtotime($endTime) - strtotime($startTime);
$w = $a/3600; //hours.minutes
$h = floor($w);
$ms = $w - floor($w);
$ms = $ms*60; //minutes.seconds
$m = floor($ms);
$s = number_format(($ms - $m)*60,3);
//basics, declare other parts if needing decimal portions
$timediff['hours']=$h;
$timediff['minutes']=$m;
$timediff['seconds']=$s;
return "$h:$m:$s";
}
timediff($startTime,$endTime);
Sam