datetime issue

Mark Lawrence breamoreboy at yahoo.co.uk
Sun Sep 16 15:23:28 EDT 2012


On 16/09/2012 16:54, Chris Angelico wrote:
> On Mon, Sep 17, 2012 at 1:40 AM,  <pandora.koura at gmail.com> 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.




More information about the Python-list mailing list