Human Readable Time

1
2
3
4
5
6
7
8
function leadZero(int) {
return int < 10 ? "0" + int : int;
}
function humanReadable(seconds) {
var sec = seconds % 60, min = (seconds - sec) / 60 % 60, hrs = (seconds - sec - min * 60) / 3600;
return leadZero(hrs) + ":" + leadZero(min) + ":" + leadZero(sec);
}