See attached file. -Stathis. Boaz Yahav wrote: > > Hi > > I need a function that will get a date in the past and return how much > time has passed since that date till now. > The input to the function is a MySQL DATETIME format and the output > should be something like : > > 2 Years, 36 Days, 7 hours , 25 minutes > > I would write it but I'm pretty sure it has been done. > > thanks > > Sincerely > > berber > > Visit http://www.weberdev.com Today!!! > To see where PHP might take you tomorrow. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
<?
// // modified by [EMAIL PROTECTED], 2000/10/01 // original: Scott Sinclair ([EMAIL PROTECTED]) submitted at www.zend.com // // $Id: sec2hms.php,v 1.8 2000/12/04 20:55:52 rouvas Exp $ // $Revision: 1.8 $ // // Convert $num_secs to Hours:Minutes:Seconds function sec2hms($num_secs) { $str = ''; $hours = intval(intval($num_secs) / 3600); $str .= $hours.':'; $minutes = intval(((intval($num_secs) / 60) % 60)); if ($minutes < 10) $str .= '0'; $str .= $minutes.':'; $seconds = intval(intval(($num_secs % 60))); if ($seconds < 10) $str .= '0'; $str .= $seconds; return($str); } ?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php