NotGiven wrote:[color=blue]
>
> Below is a good elapsed time function I found. However, I'd like to return
> total seconds instead of broken down into days, hours, minutes & seconds.
> In other words, I want "125" instead of "2 minutes 5 seconds".
>
> Any ideas? Thanks very much!
>
> function calcElapsedTime($time)
> { // calculate elapsed time (in seconds!)
> $diff = time()-$time;
> $daysDiff = floor($diff/60/60/24);
> $diff -= $daysDiff*60*60*24;
> $hrsDiff = floor($diff/60/60);
> $diff -= $hrsDiff*60*60;
> $minsDiff = floor($diff/60);
> $diff -= $minsDiff*60;
> $secsDiff = $diff;
> return ('(elapsed time '.$daysDiff.'d '.$hrsDiff.'h '.$minsDiff.'m
> '.$secsDiff.'s)');
> }[/color]
function calcElapsedTime($time)
{ // calculate elapsed time (in seconds!)
return (time()-$time);
}
Regards,
Shawn
--
Shawn Wilson
shawn@glassgiant.com http://www.glassgiant.com
I have a spam filter. Please include "PHP" in the
subject line to ensure I'll get your message.