MATLAB: Converting number to date number date I have a column of dates that are number (double format) such as 19940127 how can i convert it to matlab numeric date that corresponds to 1994/01/27? Best Answer One approach:dd = 19940127;out = datestr(datenum(num2str(dd, '%d'), 'yyyymmdd'), 'yyyy/mm/dd')out =1994/01/27To get the date number, just use part of that:out_dn = datenum(num2str(dd, '%d'), 'yyyymmdd')EDIT — Added ‘out_dn’. Related SolutionsMATLAB: Converting yyyymmdd date to matlab date number For each date, use a command like this:datestr(datenum('19940127','yyyymmdd'),'mm/dd/yyyy') MATLAB: Convert date to datetime t = datetime(DateStrings,'InputFormat','dd/MM/yyyy'); Related QuestionConverting a date column with yyyymmdd to matlab date numberHow to arrenge timeseries dataConverting date to matlab dateTransforming an integer vector into dates text vectorTime to number conversion
Best Answer