Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.03; 'anyway.': 0.04; 'sufficient': 0.05; '(of': 0.07; 'dst': 0.07; 'cc:addr:python-list': 0.09; 'creighton': 0.09; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'cc:name:laura creighton': 0.16; 'relatives': 0.16; "wouldn't": 0.16; ';-)': 0.18; 'subject:] ': 0.19; 'cc:addr:python.org': 0.20; 'cc:2**2': 0.20; 'ones.': 0.22; 'subject:skip:i 10': 0.22; 'seems': 0.23; 'cc:addr:gmail.com': 0.24; 'header:In-Reply-To:1': 0.24; 'question': 0.27; 'message- id:@mail.gmail.com': 0.27; 'arrival': 0.29; "they'll": 0.29; 'train': 0.30; 'rules': 0.31; 'knows': 0.32; 'skip:d 40': 0.32; '"")': 0.33; 'schedule': 0.34; 'except': 0.34; 'skip:d 20': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'too': 0.36; 'subject:" ': 0.36; 'subject:?': 0.36; 'beyond': 0.37; 'anything': 0.38; 'expressed': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'more': 0.63; 'canadian': 0.66; 'subject:there': 0.66; 'subject:any': 0.84; 'traveler': 0.84; 'subject:Are': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=KXrwK5XJUWAn1RCP//bxEKnmfYG8N36G6lOb5/BqPpc=; b=UuNYvL8YL06M++EzcrlQTnMJc1DhNPSmStGJhIh+vgo2l0I5NxYza1LxYp/RTmf4NB uuNYjVXCjTtkqskDuglWSSHX7Y85r7sh86aWPogZ0IWqUeTInGuBLC5qz41VRt3zBhTP XQcfBVa0Lij2eNtltvaMiHVRdbXlAPDDq/+dzYHBY1QkR2Sk5eXKMIHVfkFR+qMvzwHH ErxMBo4G2ec/lxp4LLkXqffQhC4fTqZUmrsQHTsLRib02V2ZKjGh8Qk/yxDtR4LZtoMH Ag0EYyzTi7cBchEyQv9emEfpUd3nD3ADz/r3iyFaYNL+9pW/JQu2Upr4nLcf3uXKsKqA Ds4g== X-Received: by 10.60.92.199 with SMTP id co7mr8642212oeb.37.1442189613762; Sun, 13 Sep 2015 17:13:33 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1442085362.324875.381920729.5E7A6DCE@webmail.messagingengine.com> <201509131224.t8DCOXHO004891@fido.openend.se> From: Tim Peters Date: Sun, 13 Sep 2015 19:13:19 -0500 Subject: Re: [Datetime-SIG] Are there any "correct" implementations of tzinfo? To: Guido van Rossum Cc: Laura Creighton , Alexander Belopolsky , Python-List , datetime-sig Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442189622 news.xs4all.nl 23771 [2001:888:2000:d::a6]:60349 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96536 [Guido] > Wouldn't it be sufficient for people in Creighton to set their timezone to > US/Central? IIUC the Canadian DST rules are the same as the US ones. Now, > the question may remain how do people know what to set their timezone to. > But neither pytz nor datetime can help with that -- it is up to the > sysadmin. As Laura's use case evolved, it seems it was more that a train traveler from Halifax to Creighton wants to tell their Halifax relatives when they'll arrive in Creighton, but (of course) expressed in Halifax time. Nobody in this case knows anything about Creighton's rules, except the traveler may be staring at a train schedule giving arrival in Creighton time anyway. While this may be beyond pytz's wizardy, nothing is too hard for datetime ;-) datetime.timezone.setcontext("datetime-sig messages from mid-Sep 2015") arrivaltime = datetime.strptime(scraped_arrival_time, "") arrivaltime = datetime.replace(arrivaltime, tzinfo=gettz("Context/Creighton")) print(arrivaltime.astimezone(gettz("Context/Halifax"))