Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'syntax': 0.03; 'dst': 0.07; 'pretend': 0.07; 'python': 0.09; 'boundaries': 0.09; 'confuse': 0.09; 'corresponds': 0.09; 'postgres': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sane': 0.09; 'sep': 0.09; 'bit.': 0.16; 'clocks': 0.16; 'formats,': 0.16; 'lie,': 0.16; 'offsets': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'simple.': 0.16; 'sleeping': 0.16; 'subject:issue': 0.16; 'there...': 0.16; 'timezones': 0.16; 'utc': 0.16; 'utc.': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'written': 0.20; 'all,': 0.21; 'somebody': 0.23; "i've": 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'guess': 0.27; 'rules': 0.27; 'easiest': 0.27; 'library.': 0.27; 'correct': 0.28; 'header:X-Complaints-To:1': 0.28; 'skip:( 20': 0.28; 'chris': 0.28; 'sensible': 0.29; 'from:addr:yahoo.co.uk': 0.32; 'defining': 0.33; 'handle': 0.33; 'to:addr:python-list': 0.33; 'everyone': 0.33; 'likely': 0.33; 'open': 0.35; 'there': 0.35; 'add': 0.36; 'received:org': 0.36; 'but': 0.36; 'correctly': 0.37; 'uses': 0.37; 'summer': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'some': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'easily': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'most': 0.61; 'places': 0.61; "you'll": 0.62; 'back': 0.62; 'time,': 0.62; 'different': 0.63; 'more': 0.63; 'our': 0.65; 'decided': 0.65; 'else.': 0.65; 'winter': 0.65; 'forward': 0.66; 'hours': 0.66; 'finally': 0.66; 'hour': 0.69; 'as:': 0.75; 'yourself': 0.77; 'hand': 0.82; 'but!': 0.84; 'difficult?': 0.84; 'greece': 0.84; 'metaphor': 0.84; 'southern': 0.84; 'summer,': 0.84; 'thing,': 0.84; 'worms': 0.84; 'british': 0.88; 'stamp': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: datetime issue Date: Sun, 16 Sep 2012 20:23:28 +0100 References: <52847c35-388c-4758-b72d-1d1859b788a3@googlegroups.com> <8370412f-5176-45ff-87eb-72cbca5149d5@googlegroups.com> <5680604e-98e5-48c1-b5ac-9b837bc16770@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-147-184-155.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 In-Reply-To: X-Antivirus: avast! (VPS 120916-0, 16/09/2012), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347823432 news.xs4all.nl 6869 [2001:888:2000:d::a6]:33209 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29343 On 16/09/2012 16:54, Chris Angelico wrote: > On Mon, Sep 17, 2012 at 1:40 AM, wrote: >> Cant it be written more easily as: >> date = (datetime.datetime.utcnow(+2) >> >> i know this is not thhe correct syntax but it just needs a way to add GMT+2 hours since utc=gmt > > I've dithered about whether to open this can of worms or let sleeping > dogs lie, and I finally decided to make some metaphor potpourri. > > Simple UTC offsets are not the same thing as local time. There are a > variety of other considerations, but the main one is Daylight Robbery > Time, where every government wants to put its own stamp on things by > fiddling with the DST rules a bit. Most places will move their clocks > an hour forward for summer and then back for winter. But! > > * Some places are sensible and don't have DST at all (eg > Australia/Queensland, America/Arizona) > * Northern hemisphere summer corresponds to southern hemisphere > winter, and vice versa > * Everyone has a different way of defining the boundaries of summer and winter > * And just to confuse us all, Irish Standard Time is used in summer, > and they *subtract* an hour for winter time! > > The only way to handle timezones correctly and keep yourself even > marginally sane is to hand the job on to somebody else. I dodged the > whole issue by letting our Postgres database handle everything for us > (date/time formats, timezones, the lot), and having our internal > systems all just work in UTC. You'll likely find it easiest to do the > same thing with a Python library. > > Just don't try to pretend to yourself that Greece uses GMT+2, because > it's not that simple. For one thing, it's currently summer there... > > ChrisA > I guess that Double British Summer Time made things twice as difficult? -- Cheers. Mark Lawrence.