MATLAB: Converting cell array to matlab datetime format

datetime format

Hi,
I have a cell array with dates like this '03.08.2003 23:00:00.000 GMT+0200'
I want the cell array to be converted to a datetime array. Has anyone got a suggestion for that?

Best Answer

we can replace the gmt with utc
t = {'03.08.2003 23:00:00.000 GMT+0200'};
t = strrep(t,'GMT','UTC');
t = datetime(t,'InputFormat','dd.MM.uuuu HH:mm:ss.SSS ZZZZZ','TimeZone','UTC');
t.TimeZone = '+02:00';