Created
February 17, 2024 21:17
-
-
Save saintsGrad15/acc34187da63dce88f229f9faca1ee15 to your computer and use it in GitHub Desktop.
Generate an "H:MM:SS" string from a duration of seconds
This file contains 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
const hours = Math.floor(duration / 3600); | |
const minutes = String(Math.floor(duration % 3600 / 60)).padStart(2, "0"); | |
const seconds = String(duration % 60).padStart(2, "0"); | |
return `${hours}:${minutes}:${seconds}`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment