I am currently having an issue with correct conversion of dates
The localhost
is running CET
, when I create a UTC
datetime
and convert it to PST
time it will return the default -8h (respective to UTC). This is generally true but right now there is the dailight savings offset UTC -> PST = -7 . Do I have to consider a special flag during the tz conversion?
In [3]: pytz.__version__
Out[3]: '2019.3'
In [5]: import datetime
In [6]: datetime.datetime.utcnow().astimezone(pytz.timezone('America/Los_Angeles'))
Out[6]: datetime.datetime(2021, 3, 23, 8, 53, 15, 833429, tzinfo=<DstTzInfo 'America/Los_Angeles' PDT-1 day, 17:00:00 DST>)
In [7]: !date
Tue 23 Mar 2021 05:53:20 PM CET
Code above should return 9AM , not 8AM.