Hi,
To convert the data into the required format, you can make use of the "Format" property of the "datetime" object and set it to the desired output format. Refer to the example code below for a better understanding:
% Example date and time in the format YYYYMMDD HHMMSS
originalDateTime = '20231005 123456';
% Convert the string to a datetime object with the specified input format
dt = datetime(originalDateTime, 'InputFormat', 'yyyyMMdd HHmmss');
% Set the desired output format
dt.Format = 'dd-MM-yyyy HH:mm:ss';
% Convert the datetime object to a string
formattedDateTime = char(dt);
% Display the result
disp(formattedDateTime);
For more information on the "datetime" function, refer to the below documentation: