Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Milliseconds to Timecode
let msToTime = (milliseconds) => {
let ms = milliseconds % 1000
let s = (milliseconds - ms) / 1000
let secs = s % 60
if (secs < 10) {
secs = `0${secs}`
}
s = (s - secs) / 60
let mins = s % 60
if (mins < 10) {
mins = `0${mins}`
}
let hrs = (s - mins) / 60
return mins + ':' + secs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.