%% Determine the Date of Last Occurrence of Weekday in a Month
% Determine the last Monday in June 2001.

LastDate = lweekdate(2, 2001, 6); datestr(LastDate)

%
% Determine the last Monday in a week that also contains a Friday in June 2001 returned as a datetime array.

LastDate = lweekdate(2, 2001, 6,[],'datetime')

%
% Determine the last Monday in a week that also contains a Friday in June 2001:

LastDate = lweekdate(2, 2001, 6, 6); datestr(LastDate)

%
% Determine the last Monday in May for 2001, 2002, and 2003:

Year = [2001:2003];
LastDate = lweekdate(2, Year, 5);
datestr(LastDate)

% Copyright 2012 The MathWorks, Inc.