Posted by Dawsons on 02/14/06 17:01
function sec2text($secs) {
$units = array(
86400 => 'Days',
3600 => 'Hours',
60 => 'mins',
1 => 'secs' );
$out = '';
foreach($units as $unit => $txt ) {
$t = floor($secs / $unit);
if( $t > 0 ) {
$secs -= ($t * $unit );
$out .= $t . ' ' . $txt . ' ';
}
}
return $out;
}
// behind count
$behind = time() - $take;
sec2text($behind)
-----------------------------------------------------------
Obviously the $take function is the anmount of time your taking away rom the
current time
hope this helps
Stuart
"KoRnDragon" <korndragon@gmail.com> wrote in message
news:1139863934.425246.83540@g14g2000cwa.googlegroups.com...
> Does anyone know of a script that translates time stamps to look like
> those used by Gmail? (ie. 2 days ago/ 15 minutes ago etc.)
>
[Back to original message]
|