%% Determine the Last Business Date of a Given Year and Month
% Determine the Date using an input argument for Year and Month.

Date = lbusdate(2001, 5)
datestr(Date)

%
% Determine the Date using the optional input argument for outputType.

Date = lbusdate(2001, 11,[],[],'datetime')

%
% Indicate that Saturday is a business day by appropriately setting the Weekend argument. May 31, 2003, is a Saturday. Use lbusdate to check that this Saturday is actually the last business day of the month.

Weekend = [1 0 0 0 0 0 0];
Date = datestr(lbusdate(2003, 5, [], Weekend))

% Copyright 2012 The MathWorks, Inc.