// $startstamp, $endstamp are both UNIX timestamp
// from Jan 1, 1970 mid night
function elapsed_time($startstamp, $endstamp)
{
$sec=$endstamp - $startstamp;
$hours = ($sec/3600);
list($hours, $x) = split('\.', $hours);
if ($hours < 10)
{
$hours = "0" . $hours;
}
$min = ($sec%3600);
$min = ($min/60);
list($min, $x) = split('\.', $min);
if ($min < 10)
{
$min = "0" . $min;
}
$sec = ($sec%60);
if ($sec < 10)
{
$sec = "0" . $sec;
}
return "$hours:$min:$sec";
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment