note 43935 added to function.time
| From: | Mike at rn2 dot php dot net | Date: | Fri, 09 Jul 2004 00:54:24 +0000 |
| Subject: | note 43935 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-72905@lists.php.net to get a copy of this message | ||
I tried this script (the same one listed in this thread) but when it gets past the 30 minutes it
displays 1 hour.
function thatDate($time){
$time=time()-$time;
$weeks=$time/604800;
$days=($time%604800)/86400;
$hours=(($time%604800)%86400)/3600;
$minutes=((($time%604800)%86400)%3600)/60;
$seconds=(((($time%604800)%86400)%3600)%60);
$timestring='last updated [';
if(round($days)) $timestring.=round($days)."d ";
if(round($hours)) $timestring.=round($hours)."h ";
if(round($minutes)) $timestring.=round($minutes)."m";
if(!round($minutes)&&!round($hours)&&!round($days)) $timestring.="
".round($seconds)."s";
$timestring.=']';
return $timestring;
}
It also rounds up 1 minute when past 30 seconds.
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43935
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43935&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43935&report=yes
Search -- http://master.php.net/manage/user-notes.php