Skip to content

Instantly share code, notes, and snippets.

@vanglian
Created March 22, 2014 08:30
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 vanglian/9703187 to your computer and use it in GitHub Desktop.
Save vanglian/9703187 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#A Small example of how to convert time in seconds to Days Hours & Minutes, Seconds
TimeInSeconds = 60000
Days, Remainder = divmod(TimeInSeconds,24*60*60)
Hours, Remainder = divmod(Remainder, 60*60)
Minutes, Remainder = divmod (Remainder, 60)
Seconds = Remainder
print (int(Days)," Days ",int(Hours)," Hours ", int(Minutes)," Minutes ", round(Seconds)," Seconds ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment