MATLAB: How to convert string to date datetimestring to date I would convert this string '10:12:25 Tue 11-Dec-18' into a date with this format: 11/12/2018 10:12 AM. I tried to use the function datetime, but it does not recognize the string as a date, because of the day name Tue. Best Answer Date = '10:12:25 Tue 11-Dec-18'res = datetime(Date ,'InputFormat','HH:mm:ss eee dd-MMM-yy','Format','dd/MM/yyyy HH:mm a')Date = '10:12:25 Tue 11-Dec-18'res = datetime 11/12/2018 10:12 AM Related SolutionsMATLAB: DateTime equal but report not equal They are not the same: Time1=datetime('04:00:00','InputFormat',"HH:mm:ss")Time2=datetime(0,0,0,4,0,0)produces: Time1 = datetime 25-Jul-2020 04:00:00and: Time2 = datetime 30-Nov--0001 04:00:00. MATLAB: Convert datestring to datenum problem. The trailing 'Z' is not recognized.op_datetime = '2016-11-22T13:12:47.320Z';format = 'yyyy-mm-ddTHH:MM:SS.FFF'; % No trailing 'Z'datenum(op_datetime, format) Related QuestionDatetime problem of converting stringHow to print result in matlabHow to convert these char values to datetime formatConvert Julian day to monthDatestr not working properlyChange date format in vectorConvert date to datetime
Best Answer