datetime from float python

46

DT = datetime.datetime(2016,01,30,15,16,19,234000) #trailing zeros are required
DN = (DT - datetime.datetime(2000,1,1)).total_seconds()
print repr(DN)
>>> import datetime
>>> your_timestamp = 1659362740.5430346
>>> date = datetime.datetime.fromtimestamp(your_timestamp)

Comments

Submit
0 Comments