[New-bugs-announce] [issue36899] datetime utcfromtimestamp ignores astimezone

Piotr Kamoda report at bugs.python.org
Mon May 13 05:29:19 EDT 2019


New submission from Piotr Kamoda <kamoda.piotr at gmail.com>:

See below code:
>>> datetime.utcfromtimestamp(1557395250).astimezone(get_localzone()).strftime('%Y-%m-%d %H:%M:%S %z %Z')
'2019-05-09 09:47:30 +0200 CEST'
>>> datetime.fromtimestamp(1557395250).astimezone(get_localzone()).strftime('%Y-%m-%d %H:%M:%S %z %Z')
'2019-05-09 11:47:30 +0200 CEST'

As you can see, utcfromtimestamp refuses to be 'timezoned', second one is correct.

----------
messages: 342297
nosy: Piotr Kamoda
priority: normal
severity: normal
status: open
title: datetime utcfromtimestamp ignores astimezone
versions: Python 3.7

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


More information about the New-bugs-announce mailing list