How does one get a datetime from a float in Python?
datetime
float
For e.g, I have a float such as 43111.0 and I want to get the datetime for
Looks like an Excel datetime format, called serial date. Quick and dirty way to convert it:
>>> import datetime >>> serial = 43111.0 >>> seconds = (serial - 25569) * 86400.0 >>> datetime.datetime.utcfromtimestamp(seconds) datetime.datetime(2018, 1, 11, 0, 0)