Business days for given period
bdates = busdays(sdate,edate)
bdates = busdays(___,bdmode,Holiday)
generates a vector of business days between the last business date of the period
that contains the start date (
bdates = busdays(___,
sdate), and the last business
date of period that contains the end date (
optional input arguments. If
Holiday is not supplied, the dates
are generated based on United States holidays. If you do not supply
bdates generates a daily
Determine the business days for a weekly period.
bdates = datestr(busdays('1/2/01','1/9/01','weekly'))
bdates = 2x11 char array '05-Jan-2001' '12-Jan-2001'
The end of the week is considered to be a Friday. Between 1/2/01 (Monday) and 1/9/01 (Tuesday), there is only one end-of-week day, 1/5/01 (Friday). Because 1/9/01 is part of the following week, the following Friday (1/12/01) is also reported.
Determine the business days for a weekly period using a datetime input for
bdates = busdays(datetime('2-Jan-2001','Locale','en_US'),'9-Jan-2001','weekly')
bdates = 2x1 datetime array 05-Jan-2001 12-Jan-2001
Determine the business days for a monthly period.
vec = datestr(busdays('1/8/16','3/1/16','monthly'))
vec = 3x11 char array '29-Jan-2016' '29-Feb-2016' '31-Mar-2016'
The start date (1/8/16) is in the month of January, 2016. The last business day for the month of January is 1/29/16 (Friday). The end date (3/1/16) is in the month of March, 2016. The last business day for the month of March is 3/31/16 (Thursday). The month of February, 2016 lies between the start date and the end date. The last business day for the month of February is 2/29/16 (Monday).
sdate— Start date
Start date, specified as a serial date numbers, date character vectors, or datetime arrays.
edate— End date
End date, specified as serial date numbers, date character vectors, or datetime arrays.
bdmode— Frequency of business days
1) (default) | nonnegative numeric with values
5| date character vector with values
Frequency of business days, specified as a nonnegative numeric
5 or date
character vector with values of
Valid periodicities include:
Character vectors must be enclosed in single quotation marks.
For example, if
bdmode is set to
end-of-month business dates for all full or partial months between
the start date and end date inclusive.
Holiday— Holiday and nontrading-day dates
[ ]holiday dates are based on United States holidays specified by
holidays(default) | serial date number | date character vector | datetime object
Holiday and nontrading-day dates, specified as a vector in date character
vector, serial date, or datetime array format. If you specify
Holiday, you must also supply the frequency
bdmode. Using a
Holiday value of
NaN uses a holiday list that has no dates.