Return to Snippet

Revision: 4872
at January 24, 2008 15:54 by clapfouine


Initial Code
<script>

function two(x) {return ((x>9)?"":"0")+x}
function three(x) {return ((x>99)?"":"0")+((x>9)?"":"0")+x}

function time(ms) {
var sec = Math.floor(ms/1000)
ms = ms % 1000
t = three(ms)

var min = Math.floor(sec/60)
sec = sec % 60
t = two(sec) + ":" + t

var hr = Math.floor(min/60)
min = min % 60
t = two(min) + ":" + t

var day = Math.floor(hr/60)
hr = hr % 60
t = two(hr) + ":" + t
t = day + ":" + t

return t
}

document.write(time(12034056070))
</script>

Initial URL

                                

Initial Description

                                

Initial Title
human readable millisecond timestamp

Initial Tags
convert

Initial Language
JavaScript