Last active
October 31, 2018 13:13
-
-
Save stevenkuipers/6b87ee79b8bda41379151ce1a874dbf3 to your computer and use it in GitHub Desktop.
Time string format
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
// @Param integer - Takes an integer as input | |
// integer from parameter n, where n represents number of seconds | |
// Returns a string in the format HH:MM:SS | |
// @Return string | |
// from this SO post https://stackoverflow.com/a/25279399/7384523 | |
function createTimeString(n){ | |
var date = new Date(null); | |
date.setSeconds(n); // specify value for SECONDS here | |
var timeString = date.toISOString().substr(11, 8); | |
return timeString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment