Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87937
| Date | 2015-03-24 17:18 -0600 |
|---|---|
| From | Carl Meyer <carl@oddbird.net> |
| Subject | Re: Daylight savings time question |
| References | <CAGGBd_pFpemgisb-2WFQvu8MehQfHhUJ7=n9CyYFxjj56xOV_g@mail.gmail.com> <CAPTjJmpYipDZ326JH6UaeJNSVvGOrE=85Lyn=rKdBmJvZmR3ug@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.133.1427273339.10327.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
On 03/24/2015 04:56 PM, Chris Angelico wrote: > On Wed, Mar 25, 2015 at 9:24 AM, Dan Stromberg <drsalists@gmail.com> wrote: >> Is there a way of "adding" 4 hours and getting a jump of 5 hours on >> March 8th, 2015 (due to Daylight Savings Time), without hardcoding >> when to spring forward and when to fall back? I'd love it if there's >> some library that'll do this for me. > > Fundamentally, this requires knowledge of timezone data. That means > you have to select a political time zone, which basically means you > want the Olsen database (tzdata) Yes, which is made available in Python via the pytz package. > which primarily works with city > names. I'm not sure whether "US/Pacific" is suitable; I usually use > "America/Los_Angeles" for Pacific US time. US/Pacific is an alias for America/Los_Angeles, and is also part of the Olson database (though I guess it's considered an "old" name for the timezone): https://github.com/eggert/tz/blob/master/backward Carl
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Daylight savings time question Carl Meyer <carl@oddbird.net> - 2015-03-24 17:18 -0600
csiph-web