You are here: Re: Time stamps « PHP Programming Language « IT news, forums, messages
Re: Time stamps

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.)
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация