Skip to content

Instantly share code, notes, and snippets.

@nitesh8860
Last active June 12, 2020 17:35
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 nitesh8860/33191019fd7578d0a5e35f435e34f517 to your computer and use it in GitHub Desktop.
Save nitesh8860/33191019fd7578d0a5e35f435e34f517 to your computer and use it in GitHub Desktop.
from datetime import datetime
t1='Sat 02 May 2015 19:54:36 +0530'
t2='Fri 01 May 2015 13:54:36 -0000'
t1=datetime.strptime(t1,'%a %d %b %Y %H:%M:%S %z')
t2=datetime.strptime(t2,'%a %d %b %Y %H:%M:%S %z')
# print(t1-t2)
#> 1 day, 0:30:00
print ((t1-t2).total_seconds())
#> 88200.0
#http://archive.oreilly.com/oreillyschool/courses/Python3/Python3-13.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment