%% Convert Text Representing Date to Date Number

DateString = '19-May-2001';
formatIn = 'dd-mmm-yyyy';
datenum(DateString,formatIn)

% datenum returns a date number for text representing a date with the format 'dd-mmm-yyyy'.
% Copyright 2012 The MathWorks, Inc.