Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def from_excel(value, offset=CALENDAR_WINDOWS_1900):
parts = list(jd2gcal(MJD_0, value + offset - MJD_0))
fractions = value - int(value)
diff = datetime.timedelta(days=fractions)
if 1 > value > 0 or 0 > value > -1:
return days_to_time(diff)
return datetime.datetime(*parts[:3]) + diff