Main Content

Convert Dates Between Microsoft Excel and MATLAB

Default Microsoft® Excel® date numbers represent the number of days that have passed since January 1, 1900. For example, January 1, 1950 is represented as 18264 in the Excel software.

However, MATLAB® date numbers represent the number of days that have passed since January 1, 0000, so January 1, 1950 is represented as 712224 in the MATLAB software. Therefore, the difference in dates between the Excel software and the MATLAB software is a constant, 693960 (712224 minus 18264).

To use date numbers in MATLAB calculations, apply the 693960 constant as follows:

  • Add it to Excel date numbers that are read into the MATLAB software.

  • Subtract it from MATLAB date numbers that are read into the Excel software.

    Note

    If you use the optional Excel 1904 date system, the constant is 695422.

Dates are stored internally in the Excel software as numbers and are unaffected by locale.

Related Topics