Search code examples
pythondatetimeunix-timestamp

Python unix timestamp not converting but seems value


I have Python source in trying to convert Unix timestamp to a readable form. My time stamp of 1523620800000 converts to 05/17/2018 @ 5:10pm (UTC) which is valid according to https://www.unixtimestamp.com. Here is my Python code which results in this message:

file "xxx.py", line 415, in xxx
    frmt_date = dt.datetime.utcfromtimestamp(timestamp).strftime("%Y/%m/%d %H:%M")
ValueError: year 50251 is out of range

The code sample:

frmt_date = dt.datetime.utcfromtimestamp(timestamp).strftime("%Y/%m/%d %H:%M")

Came from Python - Convert a epoch timestamp to yyyy/mm/dd hh:mm

What do you think I am doing wrong here? Thanks


Solution

  • with this timestamp i get 08/16/50251 @ 12:00am (UTC) from https://www.unixtimestamp.com, and error that is given says that year 50251 is not in datetime