Re: Need a function to calculate time difference.
| From: | \[cz\]Emo | Date: | Wed, 02 Jul 2003 23:32:27 +0000 |
| Subject: | Re: Need a function to calculate time difference. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153800@lists.php.net to get a copy of this message | ||
I use this:
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec*1000);
}
$time=getmicrotime();
echo "Page was generated in
".sprintf("%01.7f",((getmicrotime()-$time)/1000))." seconds.";
Emo
"Jack Sasportas" <Jack@InnovativeInternet.com> píse v diskusním príspevku
news:3F034A6B.6040808@InnovativeInternet.com...
> I am trying to find a function or information on how to properly take a
> start time and an end time from mysql timestamps in order to calculate
> time taken.
> So in theory $endtime-$starttime = timespent.
>
> It would be great if this understood that 11:55 pm til 12:10am one day
> apart only equals 15 minutes.
>
> Links, example code etc would be great!
>
> Thanks
>