Most datetime
objects returned from the dateutil
parser are naïve, meaning they don't have an explicit tzinfo
, which specifies the timezone and UTC offset. In the previous recipe, only one of the examples had a tzinfo
, and that's because it's in the standard ISO format for UTC datetime
strings. UTC is the coordinated universal time, and is basically the same as GMT. ISO is the
International Standards Organization, which among other things, specifies standard datetime formatting.
Python datetime
objects can either be naïve or aware. If a datetime
object has a tzinfo
, then it is aware. Otherwise, the datetime
is naïve. To make a naïve datetime
object timezone aware, you must give it an explicit tzinfo
. However, the Python datetime
library only defines an abstract baseclass for tzinfo
, and leaves it up to others to actually implement tzinfo
creation. This is where the tz
module of dateutil
comes in—it provides everything you need to look up timezones from your...