Change seconds to elapsed time

Slightly modified above presented uptime.js

function(s){ 
  var d=s/86400|0;
  var h=(s%=86400)/3600|0;
  var m=(s%=3600)/60|0; 
  return d+'d. '+('0'+h).substr(-2)+':'+('0'+m).substr(-2);
})(input)

Maybe someone will be interesting…

4 Likes