Skip to content

Instantly share code, notes, and snippets.

@dbtek
Last active May 25, 2018
Embed
What would you like to do?
Formatted relative time
module.exports = (ms) => {
var seconds = ms / 1000
var hours = Math.floor(seconds / 3600)
seconds -= hours * 3600
var minutes = Math.floor(seconds / 60)
seconds -= minutes * 60
return `${('0' + hours).slice(-2)}:${('0' + minutes).slice(-2)}:${('0' + seconds).slice(-2)}` // 00:13:09
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment