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

    %% Convert Date String to Date Vector Using Pivot Year  

%% 
% Convert text representing a date to a date vector using the default pivot year. 
DateString = '12-jun-17';
formatIn = 'dd-mmm-yy';
DateVector = datevec(DateString,formatIn)  

%% 
% Convert the same date to a date vector using 1800 as the pivot year. 
DateVector = datevec(DateString,formatIn,1800)