18 lines
556 B
JavaScript
18 lines
556 B
JavaScript
|
(function(seconds){
|
||
|
var retval = "";
|
||
|
var days = Math.floor(seconds / 3600 / 24)
|
||
|
var hours = Math.floor(seconds / 3600)
|
||
|
var minutes = Math.floor(seconds / 60)
|
||
|
hours = hours % 24
|
||
|
minutes = minutes % 60
|
||
|
seconds = seconds % 60
|
||
|
retval = retval + days + "d " + hours + "h ";
|
||
|
if (minutes < 10)
|
||
|
retval = retval + "0";
|
||
|
retval = retval + minutes + "m ";
|
||
|
if (seconds < 10)
|
||
|
retval = retval + "0";
|
||
|
retval = retval + seconds + "s";
|
||
|
return retval;
|
||
|
})(input)
|