Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20194

Re: datetime module and timezone

References <20120210222545.4cbe6924@bigfoot.com>
Date 2012-02-10 14:00 -0800
Subject Re: datetime module and timezone
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.5681.1328911220.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Fri, Feb 10, 2012 at 1:25 PM, Olive <diolu@bigfoot.com> 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 (http://pypi.python.org/pypi/pytz/ ).
And python-dateutil (http://labix.org/python-dateutil ) can apparently
parse zoneinfo files, if that's what you mean.

Cheers,
Chris

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

datetime module and timezone Olive <diolu@bigfoot.com> - 2012-02-10 22:25 +0100
  Re: datetime module and timezone John Gordon <gordon@panix.com> - 2012-02-10 21:30 +0000
  Re: datetime module and timezone Chris Rebert <clp2@rebertia.com> - 2012-02-10 14:00 -0800
  Re: datetime module and timezone Bob Martin <bob.martin@excite.com> - 2012-02-11 07:05 +0000
    Re: datetime module and timezone all mail refused <elvis-85496@notatla.org.uk> - 2012-02-11 08:51 +0000

csiph-web