Skip to content

Instantly share code, notes, and snippets.

@johnbocook
Created August 1, 2017 23:46
Show Gist options
  • Select an option

  • Save johnbocook/d855bd24c9ac7f0dfa2dba8b473ab919 to your computer and use it in GitHub Desktop.

Select an option

Save johnbocook/d855bd24c9ac7f0dfa2dba8b473ab919 to your computer and use it in GitHub Desktop.
Milliseconds to seconds
function millisToMinutesAndSeconds(millis) {
var minutes = Math.floor(millis / 60000);
var seconds = ((millis % 60000) / 1000).toFixed(0);
return minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment