Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

convert milliseconds to minutes and seconds javascript

const millisToMinutesAndSeconds = (millis) => {
    var minutes = Math.floor(millis / 60000);
    var seconds = ((millis % 60000) / 1000).toFixed(0);
	//ES6 interpolated literals/template literals 
  	//If seconds is less than 10 put a zero in front.
    return `${minutes}:${(seconds < 10 ? "0" : "")}${seconds}`;
}
    
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #milliseconds #minutes #seconds #javascript
ADD COMMENT
Topic
Name
2+4 =