Hi!
I want to convert the duration value from for example 5940000 to HH:MM:SS but according to all of the PHP functions I can think of, it’s over 64 days long! Why is that so? Is the duration value wrong?
Thanks in advance!
Nevermind! I’ve fixed it with help of this function:
function convert_milliseconds($milliseconds) {<br />
$msec_hh = 1000 * 60 * 60;<br />
$msec_mm = 1000 * 60;<br />
$msec_ss = 1000;<br />
<br />
$hh = $milliseconds / $msec_hh;<br />
$r = $milliseconds % $msec_hh;<br />
$mm = $r / $msec_mm;<br />
$r = $r % $msec_mm;<br />
$ss = $r / $msec_ss;<br />
$r = $r % $msec_ss;<br />
<br />
return sprintf("%02s:%02s:%02s", (int)$hh, (int)$mm, (int)$ss);<br />
}