OK...I wrote this...is this what you want?

return english_time("64925149");

function english_time($minutes)
{
while ($minutes>=525600) {$years++;$minutes-=525600;}
while ($minutes>=1440) {$days++;$minutes-=1440;}
while ($minutes>=60) {$hours++;$minutes-=60;}
if ($years) { $string[] = ( $years == 1) ? "1 year" : "$years years"; }
if ($days) { $string[] = ( $days == 1) ? "1 day" : "$days days"; }
if ($hours) { $string[] = ( $hours == 1) ? "1 hour" : "$hours hours"; }
if ($minutes) { $string[] = ( $minutes == 1) ? "1 minute" : "$minutes
minutes"; }
return implode(", ",$string);
}



"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm looking for a good way to convert minutes to hours, days, or years -
> the largest it will fit into.  For example, 120 would become "2 hours".
>  90 would become "1 hour and 30 minutes".  Any ideas?
>
> --
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to