On 22 December 2012 09:37, BinĂ¡ris <wikiposta(a)gmail.com> wrote:
is there a piece of code in pywiki that determines
easily if the current
time zone is summer or winter time?
(Last Sunday of March, 3 o'clock -- last
Sunday of October, 2 o'clock)
In the EU, yes. In the rest of the world, not so much (the US uses
different dates and the southern hemisphere obviously has DST in the
/other/ part of the year).
Depending on your actual question (why would you want to know when
it's summer time or not? You probably want to convert times from the
current timezone to UTC, or something ilike that)), you can try one of
the following:
pytz.timezone('Europe/Amsterdam').utcoffset(datetime.datetime.now())
or, if you're interested in the timezone offset on the current machine:
time.timezone
(which is 3600 or 7200 for Europe/Amsterdam)
Merlijn