[issue36899] datetime utcfromtimestamp ignores astimezone

Piotr Kamoda report at bugs.python.org
Mon May 13 05:44:46 EDT 2019


Piotr Kamoda <kamoda.piotr at gmail.com> added the comment:

Docs state that fromtimestamp returns a naive datetime object (https://docs.python.org/3.7/library/datetime.html#datetime.datetime.fromtimestamp) and not utcfromtimestamp. Perhaps it needs fixing.

Additionally, astimezone fails silently, I even tried
>>> datetime.utcfromtimestamp(1557395250).astimezone(pytz.utc).astimezone(get_localzone()).strftime('%Y-%m-%d %H:%M:%S %z %Z')
'2019-05-09 09:47:30 +0200 CEST'
Which looks weird, but why it ignores that function silently is also weird.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36899>
_______________________________________


More information about the Python-bugs-list mailing list