Skip to content

Instantly share code, notes, and snippets.

@seahrh
Created February 17, 2022 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seahrh/bd4aff63addc03408e85d86289b4bde4 to your computer and use it in GitHub Desktop.
Save seahrh/bd4aff63addc03408e85d86289b4bde4 to your computer and use it in GitHub Desktop.
mport math
def seconds_to_hhmmss(secs):
secs = int(secs)
hh = int(math.floor(secs / 3600))
mm = int(math.floor((secs - (hh * 3600)) / 60))
ss = secs - (hh * 3600) - (mm * 60)
return '{:02d}:{:02d}:{:02d}'.format(hh, mm, ss)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment