Use DATESTR
>> datestr(40189) ans = 12-Jan-0110
Unfortunately, Excel begins the countdown from January 1 to 1900. Learn how to convert serial dates from Matlab to Excel with DATENUM
>> datenum(2010,1,11) ans = 734149 >> datenum(2010,1,11)-40189 ans = 693960 >> datestr(40189+693960) ans = 11-Jan-2010
In other words, to convert any Excel serial date, call
datestr(excelSerialDate + 693960)
EDIT
To get the date in mm / dd / yyyy format, call datestr with the specified format
excelSerialDate = 40189; datestr(excelSerialDate + 693960,'mm/dd/yyyy') ans = 01/11/2010
In addition, if you want to get rid of the initial zero in a month, you can use REGEXPREP to fix errors
excelSerialDate = 40189; regexprep(datestr(excelSerialDate + 693960,'mm/dd/yyyy'),'^0','') ans = 1/11/2010
Jonas
source share