I've been given a pile of reports generated by someone who is no longer with us. They each begin with a decimal date and time like this: "41433.662413","41401,250002" I have tried many different methods using datetime and can't figure out how to recover the date. I know (because of a hand written note) that the above refers to 27th May 2013 6am. Any help would be greatly appreciated. Thanks.

Looks like decimal number of full days since one epoch like Microsoft Excel date.

That comes out to June 10th, 14 days off. There would be something like 28 leap years which is too far off to be a possibility. "41401,250002" comes back as May 9th at 6:00 AM (providing January 1, 1900 is correct).

import datetime
x=datetime.datetime(1900, 1, 1, 0, 0, 0) + datetime.timedelta(days=41433.662413)
print x.year, x.month, x.day, x.hour, x.minute, x.second
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.