So clearly I'm being stupid and this seemingly basic math is beyond my
abilities at the moment. I've tried various things, but can't seem to figure
out how to get the number of days integrated in here for $hh that are > 24.
I've googled for code fragments and can't find one. All seem to deal with
the Epoch and dates. I just want to take a number of seconds and convert it
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";
}

Daevid Vincent
http://daevid.com
 

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

Reply via email to