Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.127 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.75; '*S*': 0.00; 'alias': 0.09; 'dan': 0.09; 'url:github': 0.09; 'subject:question': 0.10; 'python': 0.11; 'filename:fname piece:signature': 0.16; 'from:addr:carl': 0.16; 'received:173.255': 0.16; 'wrote:': 0.18; 'library': 0.18; 'wed,': 0.18; 'basically': 0.19; 'select': 0.22; 'header:User-Agent:1': 0.23; 'package.': 0.24; 'spring': 0.24; 'skip:" 20': 0.27; 'header :In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'primarily': 0.30; "i'm": 0.30; 'getting': 0.31; 'usually': 0.31; '25,': 0.31; 'names.': 0.31; 'guess': 0.33; 'subject:time': 0.33; "i'd": 0.34; 'knowledge': 0.35; 'there': 0.35; 'pacific': 0.36; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'march': 0.61; 'received:173': 0.61; 'name': 0.63; 'love': 0.65; 'forward': 0.65; 'received:96': 0.65; 'charset:windows-1252': 0.65; 'city': 0.66; 'hours': 0.66; 'mar': 0.68; 'savings': 0.81; '2015': 0.84; 'back?': 0.84; 'olsen': 0.84; 'subject:savings': 0.84; 'url:master': 0.84; 'political': 0.97 Date: Tue, 24 Mar 2015 17:18:21 -0600 From: Carl Meyer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Daylight savings time question References: In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bun2KlAIrgTlxaAvDx5uBsPC4VGHupnNt" X-Spam-Status: No (score -1.0): ALL_TRUSTED=-1, URIBL_BLOCKED=0.001 X-Spam-Bar: - X-Mailman-Approved-At: Wed, 25 Mar 2015 09:48:57 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 54 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427273339 news.xs4all.nl 2925 [2001:888:2000:d::a6]:37526 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87937 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --bun2KlAIrgTlxaAvDx5uBsPC4VGHupnNt Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 03/24/2015 04:56 PM, Chris Angelico wrote: > On Wed, Mar 25, 2015 at 9:24 AM, Dan Stromberg wr= ote: >> 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. >=20 > 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 --bun2KlAIrgTlxaAvDx5uBsPC4VGHupnNt Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJVEfC9AAoJEC0ft5FqUuEhrR8P/ihJ7huqiEmZ+gnKKBRHUDak C/Y6E2/VUeiMZbgLti0co17/mKppVcH4fAKO0MI+4gV7C4sH0HmtyMAGbGZhi5d2 i7RM/S54iNiXvPkU4Rbwr+XAMI8R6jHk6kDWdzovZxP/Dti4Oz7IthFKLXGpwe3s 8gf5WbDA+EibfvjJU6y7uTYUQ39eWxOeCdlUluai/2jBy3G1RVXKx1c+wXeaIaZz Gr/J2knf6HlZriS7lGsXPOcaAhCxi0/EyFr66ch4duGOxgbg7JzDpM7bDjM88zB/ Uu7C5rWzWhLNY4qLz9CmSc9qMv5VKzHztG1CcK/NzzEr3NGB72K5qJUm+Ds23kb1 tffksRPMKGC4MenGqZCCcLd4NADdkHbeXIMit0QmXG2CHCQvRUOWavt55PSsZ3/6 Bi8aWqoii0sndbk8LNa0N89S0pUY0hyOXeBaVvhSyPdHtjOt3kO46Jy0F+2FsScf /Pvi2LsGrbMNZ97SjBg4me+4EHGIVrwMUZelmEZ4pX/gODAJ72/AKF44L9ssN9iT EpWIzZQOveFfiqCDR6K0J8Kg1U9qG0L58K+hdomrlW112apIPVDKcUMviNx+cmnf TBaFxQ4HVAKUtOCGLzIhKE4Yl4A6vEGnI04yZay8Qfcxc0F2tc3X3iXh3sneBYQp tC/jxpBPXySsVGpdQOOH =+3ai -----END PGP SIGNATURE----- --bun2KlAIrgTlxaAvDx5uBsPC4VGHupnNt--