Last active
December 24, 2015 16:59
-
-
Save electronicbites/6831978 to your computer and use it in GitHub Desktop.
display seconds as 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
def to_dot_time(seconds) | |
hours = seconds / 3600 | |
seconds -= hours * 3600 | |
minutes = seconds / 60 | |
seconds -= minutes * 60 | |
(hours > 0 ? [hours, minutes, seconds] : [minutes, seconds]).join(":") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment