0

I have a couple of timestamps in ordinal time such as for example 737778.582024. I want to convert it to something understandable, preferrably a datetime object. The number probably contains information down to as small as milliseconds.

In MATLAB there is the function datetime() which will give my expected result:

>> t = datetime(737778.582024,'ConvertFrom','datenum')

t = 

  datetime

   19-Dec-2019 13:58:06

In Python I could only find the function datetime.fromordinal() which only takes integers as input and thus can only convert to a date.

from datetime import  datetime
datetime.fromordinal(737778.582024)

TypeError: integer argument expected, got float

Is there a python function similar to the MATLAB one?

Sebastian Dengler
  • 1,258
  • 13
  • 30

0 Answers0