Created
September 26, 2016 19:23
-
-
Save th3d0g/a7c124b1c39f2ea474c853798acbc96b to your computer and use it in GitHub Desktop.
Convert seconds to 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
// Format seconds to hh:mm:ss. | |
function formatSeconds(seconds) | |
{ | |
var date = new Date(1970,0,1); | |
date.setSeconds(seconds); | |
return date.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment