Created
February 7, 2015 06:50
-
-
Save abelorian/f06f0c8b70fd62612a16 to your computer and use it in GitHub Desktop.
Seconds to HH:MM:SS
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
function sec(time){ | |
var all_time = time; | |
var hours = Math.floor(time / 3600); | |
var minutes = Math.floor((time % 3600)/60); | |
var seconds = time % 60; | |
minutes = minutes < 10 ? '0' + minutes : minutes; | |
seconds = seconds < 10 ? '0' + seconds : seconds ; | |
var result = hours +" : " + minutes + " : " + seconds; | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment