How to convert an Excel date to a string in Python

Dates in Excel are stored as numbers, where the number represents how many days the date occurred after January 1st, 1900. For example, the number 43831 represents January 1st, 2020. Converting 43831 to a string returns 2020-01-01.

Solution for How to convert an Excel date to a string in Python : You can use xlrd.xldate_as_datetime() to convert an Excel date to a string Call xlrd.xldate_as_datetime(date, 0) to convert the Excel date to a datetime.datetime object. Call datetime.datetime.date() on the datetime.datetime object returned from the last call to return the date as a datetime.date object. Convert the returned datetime.date object to a string in ISO date format by calling datetime.date.isoformat().


how-to-convert-an-excel-date-to-a-string-in-python