t = datetime(str,'InputFormat','dd-MMM-yyyy HH:mm:ss')t =3×1 datetime array24-Oct-2016 11:58:17
19-Nov-2016 09:36:29
12-Dec-2016 10:09:06Convert a datetime value to a string.t = datetime('25-Dec-2016 06:12:34');
str = string(t)str ="25-Dec-2016 06:12:34"Convert Between Datetime and Date Vectors
A date vector is a 1-by-6 vector of double-precision numbers. Elements of a date vector
are integer-valued, except for the seconds element, which can be fractional. Time values
are expressed in 24-hour notation. There is no AM or PM setting.A date vector is arranged in the following order:year month day hour minute secondThe following date vector represents 10:45:07 AM on October 24, 2012:[2012 10 24 10 45 07]Convert one or more date vectors to a datetime array using the datetime function:t = datetime([2012 10 24 10 45 07])t =datetime24-Oct-2012 10:45:07Instead of using datevec to extract components of datetime values, use functions such as
year, month, and day instead:7 Dates and Time