from datetime import datetime as dt
time_str = '1606964238000'
ref_time = int(time_str)
ref_time = dt.utcfromtimestamp(ref_time).strftime('%Y-%m-%d %H:%M:%S')
This gives an error:
ValueError Traceback (most recent call last)
<ipython-input-10-39d1e0d079a8> in <module>
----> 1 ref_time = dt.utcfromtimestamp(ref_time).strftime('%Y-%m-%d %H:%M:%S')
ValueError: year 52892 is out of range
The same code can parse this unix time correctly:
time_str = '1594553700'
which is '2020-07-12 11:35:00'.
But i am sure the first unixtime is also valid, because it is from docker container machine to generate automatically. How can I parse it into a valid datetime object?