note 43935 rejected from function.time by aidan
| From: | aidan@php.net | Date: | Fri, 09 Jul 2004 02:03:10 +0000 |
| Subject: | note 43935 rejected from function.time by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72907@lists.php.net to get a copy of this message | ||
Note Submitter: Mike
----
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.