Decimal date and time conversion

I was given a bunch of reports generated by someone who is no longer with us. Each of them starts with a decimal date and time: "41433.662413", "41401.250002" I tried many different methods using the date and time, and I can not figure out how to restore the date. I know (due to a written note) that the above applies on May 27, 2013 at 6 a.m. Any help would be greatly appreciated. Thanks.

+4
source share
1 answer

It looks like OLE Automation dates that are used on many systems, such as Microsoft Excel . This is an effective floating point value representing days, with a value of 1.0 equal to midnight on January 1, 1900.

You can convert to python date with:

from datetime import timedelta, datetime d = timedelta(days=41433.662413) st = datetime(1899,12,31) date = st + d print(date) 

Opens 2013-06-09 15:53:52.483200 . Although this is different from the May 27 date that you talked about, given that you included more than one input, I suspect this is the correct conversion, as it will be a standard that provides dates and times within the same range as your written note. However, not knowing exactly which entry corresponds to this date, it would be difficult to say.

On May 27th, at 6am, the value 41420.25 will be used using this conversion. I would check this β€œvalue” to see if the handwritten note matches this format.

+7
source

Source: https://habr.com/ru/post/1485491/


All Articles