Javascript Date secondstominutes(secs)

Description

Javascript Date secondstominutes(secs)

// Show seconds in format minutes:seconds
/* Example://from  w w  w .j a  v a 2 s  .co m
    secondstominutes(1); // result 00:01
    secondstominutes(50); // result 00:50
    secondstominutes(61); // result 01:01
*/
function secondstominutes(secs){
   return ((arguments[1]=(Math.floor(secs/60)))<10?"0":"")+arguments[1]+":"+((arguments[2]=secs%60)<10?"0":"") + arguments[2];
}



PreviousNext

Related