<div dir="ltr">Zajímavé: <a href="https://github.com/stub42/pytz/blob/master/tz/europe">https://github.com/stub42/pytz/blob/master/tz/europe</a><div><br></div><div><div><font face="monospace, monospace" size="1"># Czech Republic / Czechia</font></div><div><font face="monospace, monospace" size="1"># Rule<span style="white-space:pre"> </span>NAME<span style="white-space:pre"> </span>FROM<span style="white-space:pre"> </span>TO<span style="white-space:pre"> </span>TYPE<span style="white-space:pre"> </span>IN<span style="white-space:pre"> </span>ON<span style="white-space:pre"> </span>AT<span style="white-space:pre"> </span>SAVE<span style="white-space:pre"> </span>LETTER/S</font></div><div><font face="monospace, monospace" size="1">Rule<span style="white-space:pre"> </span>Czech<span style="white-space:pre"> </span>1945<span style="white-space:pre"> </span>only<span style="white-space:pre"> </span>-<span style="white-space:pre"> </span>Apr<span style="white-space:pre"> </span> 8<span style="white-space:pre"> </span>2:00s<span style="white-space:pre"> </span>1:00<span style="white-space:pre"> </span>S</font></div><div><font face="monospace, monospace" size="1">Rule<span style="white-space:pre"> </span>Czech<span style="white-space:pre"> </span>1945<span style="white-space:pre"> </span>only<span style="white-space:pre"> </span>-<span style="white-space:pre"> </span>Nov<span style="white-space:pre"> </span>18<span style="white-space:pre"> </span>2:00s<span style="white-space:pre"> </span>0<span style="white-space:pre"> </span>-</font></div><div><font face="monospace, monospace" size="1">Rule<span style="white-space:pre"> </span>Czech<span style="white-space:pre"> </span>1946<span style="white-space:pre"> </span>only<span style="white-space:pre"> </span>-<span style="white-space:pre"> </span>May<span style="white-space:pre"> </span> 6<span style="white-space:pre"> </span>2:00s<span style="white-space:pre"> </span>1:00<span style="white-space:pre"> </span>S</font></div><div><font face="monospace, monospace" size="1">Rule<span style="white-space:pre"> </span>Czech<span style="white-space:pre"> </span>1946<span style="white-space:pre"> </span>1949<span style="white-space:pre"> </span>-<span style="white-space:pre"> </span>Oct<span style="white-space:pre"> </span>Sun>=1<span style="white-space:pre"> </span>2:00s<span style="white-space:pre"> </span>0<span style="white-space:pre"> </span>-</font></div><div><font face="monospace, monospace" size="1">Rule<span style="white-space:pre"> </span>Czech<span style="white-space:pre"> </span>1947<span style="white-space:pre"> </span>only<span style="white-space:pre"> </span>-<span style="white-space:pre"> </span>Apr<span style="white-space:pre"> </span>20<span style="white-space:pre"> </span>2:00s<span style="white-space:pre"> </span>1:00<span style="white-space:pre"> </span>S</font></div><div><font face="monospace, monospace" size="1">Rule<span style="white-space:pre"> </span>Czech<span style="white-space:pre"> </span>1948<span style="white-space:pre"> </span>only<span style="white-space:pre"> </span>-<span style="white-space:pre"> </span>Apr<span style="white-space:pre"> </span>18<span style="white-space:pre"> </span>2:00s<span style="white-space:pre"> </span>1:00<span style="white-space:pre"> </span>S</font></div><div><font face="monospace, monospace" size="1">Rule<span style="white-space:pre"> </span>Czech<span style="white-space:pre"> </span>1949<span style="white-space:pre"> </span>only<span style="white-space:pre"> </span>-<span style="white-space:pre"> </span>Apr<span style="white-space:pre"> </span> 9<span style="white-space:pre"> </span>2:00s<span style="white-space:pre"> </span>1:00<span style="white-space:pre"> </span>S</font></div><div><font face="monospace, monospace" size="1"># Zone<span style="white-space:pre"> </span>NAME<span style="white-space:pre"> </span>GMTOFF<span style="white-space:pre"> </span>RULES<span style="white-space:pre"> </span>FORMAT<span style="white-space:pre"> </span>[UNTIL]</font></div><div><font face="monospace, monospace" size="1">Zone<span style="white-space:pre"> </span>Europe/Prague<span style="white-space:pre"> </span>0:57:44 -<span style="white-space:pre"> </span>LMT<span style="white-space:pre"> </span>1850</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre"> </span>0:57:44<span style="white-space:pre"> </span>-<span style="white-space:pre"> </span>PMT<span style="white-space:pre"> </span>1891 Oct # Prague Mean Time</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre"> </span>1:00<span style="white-space:pre"> </span>C-Eur<span style="white-space:pre"> </span>CE%sT<span style="white-space:pre"> </span>1944 Sep 17 2:00s</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre"> </span>1:00<span style="white-space:pre"> </span>Czech<span style="white-space:pre"> </span>CE%sT<span style="white-space:pre"> </span>1979</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre"> </span>1:00<span style="white-space:pre"> </span>EU<span style="white-space:pre"> </span>CE%sT</font></div><div><font face="monospace, monospace" size="1"># Use Europe/Prague also for Slovakia.</font></div></div><div><br></div><div>Takže ten default je asi PMT - Prague Mean Time z roku 1891? :)</div><div><br></div><div>PM<br><div class="gmail_extra"><br><div class="gmail_quote">Dne 26. července 2017 17:32 Daniel Milde <span dir="ltr"><<a href="mailto:daniel@milde.cz" target="_blank">daniel@milde.cz</a>></span> napsal(a):<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Ahoj,<br>
ještě doplním proč to tak je:</p><span class="gmail-">
<p>>>> tz = pytz.timezone('Europe/Prague')</p>
</span><p>pytz neví, jaký offset má použít, protože timezone Europe/Prague
může být +1 nebo +2 (letní čas). <br>
Spadne proto do nějakého divného defaultu, který je PMT+0:58:00
STD :)<br>
<br>
Teprve když timezonu svážeme s konrétním datumem přes localize,
nastaví pytz správný offset.</p>
<p>Dan<br>
</p>
<br>
<div class="gmail-m_1047629509117405077moz-cite-prefix">Dne 26.7.2017 v 09:47 Vláďa Macek
napsal(a):<br>
</div>
<blockquote type="cite"><div><div class="gmail-h5">
<p> Dejte si bacha.</p>
<p> Pekne me dnes pokousaly timezony a to jsem si myslel, ze se
vyznam. :-)</p>
<p>Django 1.11 preslo nejak vic na vyuzivani `pytz`, ktere dodava
casove zony s vice informacemi a datetime.replace, ktere jsem do
te doby nespravne pouzival, se mi fakt nevyplatilo...</p>
<blockquote>
<p>>>> import datetime<br>
>>> import pytz<br>
<br>
>>> tz = pytz.timezone('Europe/Prague')<br>
>>> tz<br>
<DstTzInfo 'Europe/Prague' PMT+0:58:00 STD><br>
>>> # Strasidelne. :-) To mam nekde chybu, ne...</p>
>>> d_praha_naivni = datetime.datetime(2017, 6, 8, 10,
19, 52)<br>
>>> d_praha_vnuceno_blbe =
d_praha_naivni.replace(tzinfo=<wbr>tz)<br>
<br>
>>> d_utc_naivni =
datetime.datetime.strptime('<wbr>2017-06-08T08:19:52+00:00',
'%Y-%m-%dT%H:%M:%S+00:00')<br>
>>> d_utc_naivni<br>
datetime.datetime(2017, 6, 8, 8, 19, 52)<br>
<br>
>>> d_utc_vnuceno_blbe =
d_utc_naivni.replace(tzinfo=<wbr>pytz.utc)<br>
>>> d_utc_vnuceno_blbe<br>
datetime.datetime(2017, 6, 8, 8, 19, 52, tzinfo=<UTC>)<br>
<br>
>>> d_praha_vnuceno_blbe == d_utc_vnuceno_blbe<br>
False<br>
>>> # Pritom stejny cas... lepe:<br>
<br>
>>> d_praha = tz.localize(d_praha_naivni)<br>
>>> d_praha<br>
datetime.datetime(2017, 6, 8, 10, 19, 52, tzinfo=<DstTzInfo
'Europe/Prague' CEST+2:00:00 DST>)<br>
<br>
>>> d_utc = pytz.utc.localize(d_utc_<wbr>naivni)<br>
>>> d_utc<br>
datetime.datetime(2017, 6, 8, 8, 19, 52, tzinfo=<UTC>)<br>
<br>
>>> d_praha == d_utc<br>
True<br>
>>> # Konecne mi to uznal. :-)<br>
<br>
>>> d_utc == d_utc_vnuceno_blbe<br>
True<br>
>>> # Vnuceni UTC pomoci replace() zjevne vadi min...
:-><br>
<br>
</blockquote>
<br>
<fieldset class="gmail-m_1047629509117405077mimeAttachmentHeader"></fieldset>
<br>
</div></div><span class="gmail-"><pre>______________________________<wbr>_________________
Python mailing list
<a class="gmail-m_1047629509117405077moz-txt-link-abbreviated" href="mailto:python@py.cz" target="_blank">python@py.cz</a>
<a class="gmail-m_1047629509117405077moz-txt-link-freetext" href="http://www.py.cz/mailman/listinfo/python" target="_blank">http://www.py.cz/mailman/<wbr>listinfo/python</a>
Visit: <a class="gmail-m_1047629509117405077moz-txt-link-freetext" href="http://www.py.cz" target="_blank">http://www.py.cz</a></pre>
</span></blockquote>
<br>
</div>
<br>______________________________<wbr>_________________<br>
Python mailing list<br>
<a href="mailto:python@py.cz">python@py.cz</a><br>
<a href="http://www.py.cz/mailman/listinfo/python" rel="noreferrer" target="_blank">http://www.py.cz/mailman/<wbr>listinfo/python</a><br>
<br>
Visit: <a href="http://www.py.cz" rel="noreferrer" target="_blank">http://www.py.cz</a><br></blockquote></div><br></div></div></div>