note 9676 deleted from function.time by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 23:54:45 +0000 |
| Subject: | note 9676 deleted from function.time by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22390@lists.php.net to get a copy of this message | ||
ok for this thing that shows how long somone was online i wrote this... what you do is use the time
stamp of the when someone did something and then subtract it from the current time() and then put it
into this
$online_for = (time()-<time logged on>);
if($online_for < 60){ $sec=$online_for; $min=0; $hour=0; }
else
if($online_for < 3600){ $sec=$online_for%60; $hour=0; $min_t = explode('.',
number_format($online_for/60,2)); $min=$min_t[0]; }
else
if($online_for >= 216000){ $hour_t = explode('.',
number_format($online_for/216000,2)); $hour=$hour_t[0]; $sec=$online_for%60; $min_te =
$online_for%216000; $min_t = explode('.', number_format($min_te/60,2)); $min=$min_t[0];}
and this out puts $hour, $min and $sec
the code looks wacko but it was the best way to do what i wanted ;)