Piotr Kamoda <kamoda.pi...@gmail.com> added the comment:

Ok, now I see that naive object assumes my timezone in some cases. That's still 
mind-boggling that utcfromtimestamp returns an object that shows utc hour but 
when astimezone is applied it reverts without converting the hour to local 
timezone.

See below as explanation:
>>> datetime.utcfromtimestamp(1557395250).astimezone(pytz.utc).strftime('%Y-%m-%d
>>>  %H:%M:%S %z %Z')
'2019-05-09 07:47:30 +0000 UTC'
>>> datetime.utcfromtimestamp(1557395250).astimezone(get_localzone()).strftime('%Y-%m-%d
>>>  %H:%M:%S %z %Z')
'2019-05-09 09:47:30 +0200 CEST'

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36899>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to