openpyxl.utils.datetime module

Manage Excel date weirdness.

openpyxl.utils.datetime.days_to_time(value)[源代码]
openpyxl.utils.datetime.from_ISO8601(formatted_string)[源代码]

Convert from a timestamp string to a datetime object. According to 18.17.4 in the specification the following ISO 8601 formats are supported.

Dates B.1.1 and B.2.1 Times B.1.2 and B.2.2 Datetimes B.1.3 and B.2.3

There is no concept of timedeltas in the specification, but Excel writes them (in strict OOXML mode), so these are also understood.

openpyxl.utils.datetime.from_excel(value, epoch=datetime.datetime(1899, 12, 30, 0, 0), timedelta=False)[源代码]

Convert Excel serial to Python datetime

openpyxl.utils.datetime.time_to_days(value)[源代码]

Convert a time value to fractions of day

openpyxl.utils.datetime.timedelta_to_days(value)[源代码]

Convert a timedelta value to fractions of a day

openpyxl.utils.datetime.to_ISO8601(dt)[源代码]

Convert from a datetime to a timestamp string.

openpyxl.utils.datetime.to_excel(dt, epoch=datetime.datetime(1899, 12, 30, 0, 0))[源代码]

Convert Python datetime to Excel serial