[issue36899] datetime utcfromtimestamp ignores astimezone

2019-05-13 Thread SilentGhost
SilentGhost added the comment: Naïve object does not assume anything, naïve object *lacks* timezone information. It cannot convert anything. It is a mistake to set a wrong timezone to a naïve object, a mistake that you're making. Piotr, this is a bug tracker for development of CPython, let's

[issue36899] datetime utcfromtimestamp ignores astimezone

2019-05-13 Thread Piotr Kamoda
Piotr Kamoda 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 exp

[issue36899] datetime utcfromtimestamp ignores astimezone

2019-05-13 Thread SilentGhost
SilentGhost added the comment: In the same page about utcfromtimestamp https://docs.python.org/3.7/library/datetime.html#datetime.datetime.utcfromtimestamp it says: > with tzinfo None Also below, "To get an aware datetime object". All this means or implies naïve object. I've no idea what y

[issue36899] datetime utcfromtimestamp ignores astimezone

2019-05-13 Thread Piotr Kamoda
Piotr Kamoda 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 >>> datet

[issue36899] datetime utcfromtimestamp ignores astimezone

2019-05-13 Thread SilentGhost
Change by SilentGhost : -- components: +Library (Lib) ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue36899] datetime utcfromtimestamp ignores astimezone

2019-05-13 Thread SilentGhost
SilentGhost added the comment: The utcfromtimestamp returns a naïve object that is assumed to be in the UTC timezone, you're then effectively turning it into a aware object in CEST timezone. I'm not sure what you think is wrong with utcfromtimestamp here, but it behaves according to documenta

[issue36899] datetime utcfromtimestamp ignores astimezone

2019-05-13 Thread Piotr Kamoda
New submission from Piotr Kamoda : 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 %