Skip to content

Instantly share code, notes, and snippets.

@saghul
Created February 1, 2011 00:12
Show Gist options
  • Save saghul/805121 to your computer and use it in GitHub Desktop.
Save saghul/805121 to your computer and use it in GitHub Desktop.
Example substracting timezone aware and timezone naive datetime objects
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