Sorry, I forgot to add my example...
t = datetime('2003-01-16T06:28:00Z','TimeZone','local','Format','yyyy-MM-dd''T''HH:mm:ss Z')
Hello Robert:
I assume the original date is given in ISO8601 format. In that case 'Z' means zero offset to UTC+0.
Nevertheless, here is the code to read and convert as you requested:
t = datetime('2003-01-16T06:28:00Z','TimeZone','local','InputFormat','yyyy-MM-dd''T''HH:mm:ssX');
tOut = char( datetime(t,'Format','yyyy/MM/DD/HH/mm/ss') ); cOut = strsplit(tOut,'/');
strOut = sprintf('YYYY mm dd HH MM SS\n'); strOut = [strOut,sprintf('%4s %2s %2s %2s %2s %2s\n',cOut{1},cOut{2},cOut{3},cOut{4},cOut{5},cOut{6})];
disp(strOut)
Kind regards,
Robert
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!