www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/DateandTimefromStringsExample.m

    %% Date and Time from Character Vectors 
% Create a |datetime| array from a cell array of character vectors.   

%%  
DateStrings = {'2014-05-26';'2014-08-03'};
t = datetime(DateStrings,'InputFormat','yyyy-MM-dd') 

%%
% The datetime values in |t| display using the default format, and not the
% format of the input dates.