Paul Ganssle <p.gans...@gmail.com> added the comment:
There's a pretty clear warning on the documentation that utcfromtimestamp is unsuitable for this purpose: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp What you want is a datetime that knows what time zone it's in, so that it can be translated back into the absolute number of seconds since UTC. The correct way to do that is to tell the datetime it's in UTC by attaching the `datetime.timezone.utc` object (or any equivalent `tzinfo`). I have written a blog post explaining in detail why you should not use `utcnow` or `utcfromtimestamp`: https://blog.ganssle.io/articles/2019/11/utcnow.html Hopefully that is helpful to you. ---------- resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41118> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com