Skip to content
Advertisement

javascript parse time (minutes:seconds) from milliseconds

How to parse a given amount of milliseconds (e.g. 125230.41294642858) into a time format like: minutes:seconds?

Answer

var ms = 125230.41294642858,
   min = 0|(ms/1000/60),
   sec = 0|(ms/1000) % 60;

alert(min + ':' + sec);
Advertisement