Skip to content

Instantly share code, notes, and snippets.

@mohan43u
Created June 21, 2015 04:51
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 mohan43u/5a0617308dc1f9a2bc24 to your computer and use it in GitHub Desktop.
Save mohan43u/5a0617308dc1f9a2bc24 to your computer and use it in GitHub Desktop.
snip to calculate timedifference
#!/usr/bin/env python
import time
import datetime
import sys
datetime0 = datetime.datetime.fromtimestamp(time.mktime(time.strptime(sys.argv[2], '%H:%M:%S')))
datetime1 = datetime.datetime.fromtimestamp(time.mktime(time.strptime(sys.argv[1], '%H:%M:%S')))
print(datetime0 - datetime1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment