Created
September 12, 2017 07:18
-
-
Save netsi1964/96a064284075d201e2f2722f157cf70a to your computer and use it in GitHub Desktop.
Convert a youtube time to visual hh:mm:ss
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
Object.prototype.toTimeString = function() { | |
var t = parseFloat(this); | |
var hou = (parseInt(t / 3600) % 24).toString().padStart(2, "0"), | |
min = (parseInt(t / 60) % 60).toString().padStart(2, "0"), | |
sec = parseInt(t % 60) | |
.toString() | |
.padStart(2, "0"); | |
return `${hou}:${min}:${sec}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment