Created
February 1, 2011 00:12
-
-
Save saghul/805121 to your computer and use it in GitHub Desktop.
Example substracting timezone aware and timezone naive datetime objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [39]: d1 = datetime.now() | |
In [40]: d2 = datetime.now(tzlocal()) | |
In [41]: d2-d1 | |
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
/home/saghul/work/<ipython console> in <module>() | |
TypeError: can't subtract offset-naive and offset-aware datetimes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment