jquery-runner
jquery-runner copied to clipboard
How to Format?
Hi,
I'm with problem, when I have the time 01:00.00 or 01:00 the time when start show 59 or 59.xx (milliseconds) how to format to 00:59.xx and 00:59 How can I format this way?
To display 02:10:08
instead 2:10:8
you can use this code:
format: function(m, s){
var sec = Math.floor((m / 1000) % 60);
var min = Math.floor((m / 60000) % 60);
var hor = Math.floor((m / 3600000) % 24);
sec = sec < 10 ? '0' + sec : sec;
min = min < 10 ? '0' + min : min;
hor = hor < 10 ? '0' + hor : hor;
return hor + ':' + min + ':' + sec;
}