You can use 'setvaropts' to change the format of datetime variables. For example:
opts = detectImportOptions('example.csv');
opts = opts.setvaropts('myVariable','InputFormat','M/d/yyyy','DateTimeFormat','dd-MMM-yyyy');
t = readtable('example.csv',opts)
'InputFormat' tells 'readtable' how to interpret the values in the file, while 'DateTimeFormat' tells MATLAB how to display the datetimes once they are in MATLAB.
For more information, refer to the "Import Date and Time Data" section on the following documentation page:
Best Answer