note 59307 deleted from function.time by betz
| From: | betz@php.net | Date: | Fri, 02 Dec 2005 17:57:21 +0000 |
| Subject: | note 59307 deleted from function.time by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99468@lists.php.net to get a copy of this message | ||
Note Submitter: postmeister at gruppenfreizeit dot com
Reason: non-english
----
another simple function to receive a timestamp value in years, weeks, days , hours, minutes and
seconds:
function onlinezeit($timestamp){
$foo=$timestamp/60/60/24/52;
$jahre=intval($foo);
$foo=($foo-$jahre)*52/7;
$wochen=intval($foo);
$foo=($foo-$wochen)*7;
$tage=intval($foo);
$foo=($foo-$tage)*24;
$std=intval($foo);
$foo=($foo-$std)*60;
$min=intval($foo);
$foo=($foo-$min)*60;
$sex=intval($foo);
if($jahre>0)$strtime =$jahre .' Jahre,';
if($wochen>0)$strtime.=$wochen .' Wochen,';
if($tage>0)$strtime.=$tage.' Tage,';
if($std>0)$strtime.=$std.' Stunden,';
if($min>0)$strtime.=$min.' Minuten,';
if($sex>0)$strtime.=$sex.' Sekunden';
return $strtime;}
returns something like x Jahre, y Wochen, ...