[New-bugs-announce] [issue46856] datetime.max conversion

Joris Geysens report at bugs.python.org
Fri Feb 25 11:10:01 EST 2022


New submission from Joris Geysens <joris.geysens at enervalis.com>:

Reading the documentation, I don't understand how this is not possible : 

# get the max utc timestamp
ts = datetime.max.replace(tzinfo=timezone.utc).timestamp()

# similarly 
ts2 = datetime(9999, 12, 31, 23, 59, 59, 999999, tzinfo=timezone.utc).timestamp()

# timestamp value 253402300800 seems correct
# converting back to timestamp is impossible, these all fail : 

dt = datetime.fromtimestamp(ts, tz=timezone.utc)
dt = datetime.utcfromtimestamp(ts)

It should be possible to get a datetime back from the initially converted timestamp, no?

----------
messages: 414013
nosy: joris.geysens
priority: normal
severity: normal
status: open
title: datetime.max conversion
type: behavior
versions: Python 3.9

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


More information about the New-bugs-announce mailing list