Last active
May 25, 2018 09:03
-
-
Save dbtek/799a1a588047543e66421042ce853c22 to your computer and use it in GitHub Desktop.
Formatted relative time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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