[prev in list] [next in list] [prev in thread] [next in thread]
List: php-general
Subject: Re: [PHP] Has anyone written such a function?
From: Rouvas Stathis <rouvas () di ! uoa ! gr>
Date: 2002-03-31 19:44:34
[Download RAW message or body]
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
["sec2hms.php" (text/plain)]
<?
//
// modified by rouvas@di.uoa.gr, 2000/10/01
// original: Scott Sinclair (scott@uq.edu.au) 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic