datetime module and timezone

Chris Rebert clp2 at
Fri Feb 10 17:00:16 EST 2012

On Fri, Feb 10, 2012 at 1:25 PM, Olive <diolu at> wrote:
> In the datetime module, it has support for a notion of timezone but is
> it possible to use one of the available timezone (I am on Linux). Linux
> has a notion of timezone (in my distribution, they are stored
> in /usr/share/zoneinfo). I would like to be able 1) to know the current
> timezone

time.tzname gives the zone names (plural due to DST); time.timezone
and time.altzone gives their UTC offsets.

> and 2) to be able to use the timezone available on the system.

You can use the name to look it up in pytz ( ).
And python-dateutil ( ) can apparently
parse zoneinfo files, if that's what you mean.


More information about the Python-list mailing list