Just a small example: By default if you call datetime.datetime.now(), all you get is the current datetime depending on your os.environ['TZ'] setting but still without attributes like tzname and so on containing useful values.
But if you now do something like this:
datetime.datetime.now(dateutil.tz.tzlocal())
The resulting datetime instance will hold the right values for your local timezone :-)
But an even cooler method is the dateutil.tz.gettz method. What does it do? It basically returns a tzinfo instance for whatever timezone name you pass to it.
datetime.datetime.now(dateutil.tz.gettz('Europe/Vienna'))
During my messing around with timezones on Dreamhost this tool came in verrry handy. Esp. the last snippets helped quite a lot when I wanted to convert an un-timezoned datetime object (which actually had the local time) into an UTC datetime object. Sure it is possible without gettz, but it made the code way more readable.
For more information and further examples, check out http://labix.org/python-dateutil
Comments: