/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>
Comments
