Skip to content

Instantly share code, notes, and snippets.

@electronicbites
Last active December 24, 2015 16:59
Show Gist options
  • Save electronicbites/6831978 to your computer and use it in GitHub Desktop.
Save electronicbites/6831978 to your computer and use it in GitHub Desktop.
display seconds as hh:mm:ss
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