"Jennifer Goodie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >can't seem to figure
> > out how to get the number of days integrated in here for $hh that
> > are > 24.
> > to days:hours:minutes:seconds...  This function works for what it
> > does, can
> > someone embelish it to handle days too?
> >
> > function convertToHHMMSS($seconds)
> > {
> > $hoursPerDay = 24;
> > $SecondsPerHour = 3600;
> > $SecondsPerMinute = 60;
> > $MinutesPerHour    = 60;
> >
> > $hh = intval($seconds / $SecondsPerHour);
> >     $mm = intval($seconds / $SecondsPerMinute) % $MinutesPerHour;
> >     $ss = $seconds % $SecondsPerMinute;
> >
> > return $hh."h:".$mm."m:".$ss."s";
> > }
>
> Not quite what you're looking for, but I'm sure you can figure out how to
> customize it
>
> function sec2time($sec){
(snip)
>

This is less code and is tested.

$seconds = 86397; // any starting value
$days = floor($seconds/86400);
    $days_mod = $seconds%86400;
$hours = floor($days_mod/3600);
    $hours_mod = $days_mod%3600;
$minutes = floor($hours_mod/60);
    $minutes_mod = $hours_mod%60;
$seconds = floor($minutes_mod);

- Kevin

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

Reply via email to