Created
March 12, 2018 22:23
-
-
Save noudadrichem/69f7db4d374e83dbf4a20f0fea42a5bd to your computer and use it in GitHub Desktop.
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
secondsToHourMinuteSecond(totalSeconds) { | |
let hour = Math.floor(totalSeconds / 3600); | |
let minute = Math.floor(totalSeconds % 3600 / 60); | |
let seconds = Math.floor(totalSeconds % 3600 % 60); | |
return `${('0' + hour).slice(-2)}:${('0' + minute).slice(-2)}:${('0' + seconds).slice(-2)}` | |
} | |
/* | |
returns total seconds to hh:mm:ss value. | |
e.g. 133 seconds = 00:02:13 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment