Skip to content

Instantly share code, notes, and snippets.

@edgarberm
Created October 30, 2014 19:03
Show Gist options
  • Save edgarberm/6a704a06c6fe489bfb26 to your computer and use it in GitHub Desktop.
Save edgarberm/6a704a06c6fe489bfb26 to your computer and use it in GitHub Desktop.
Converts a value in milliseconds to seconds
function millisecondsToSeconds(time) {
var m = Math.floor((((time % 31536000) % 86400) % 3600) / 60);
var s = (((time % 31536000)% 86400) % 3600) % 60;
if (s > 9) {
return m + ":" + Math.round(s);
} else {
return m + ":0" + Math.round(s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment