Next or previous business day
Busday = busdate(Date)
Busday = busdate(___,DirFlag,Holiday,Weekend)
either serial date numbers or date character vectors,
returned as a serial date number.
However, if either
Busday is returned as a datetime
Use the function
convert serial date numbers to formatted date character vectors.
Determine the next business day when
Date is a character vector.
Busday = busdate('3-Jul-2001', 1)
Busday = 731037
ans = '05-Jul-2001'
Indicate that Saturday is a business day by appropriately setting the
Weekend argument. July 4, 2003 falls on a Friday. Use
busdate to verify that Saturday, July 5, is actually a business day.
Weekend = [1 0 0 0 0 0 0]; Date = datestr(busdate('3-Jul-2003', 1, , Weekend))
Date = '05-Jul-2003'
Holiday are datetime arrays,
Busday is returned as a datetime array.
Busday = busdate(datetime('3-Jul-2001','Locale','en_US'), 1)
Busday = datetime 05-Jul-2001
Date— Reference business date
Reference business date, specified as a scalar, vector, or matrix using serial date numbers, date character vectors, or datetime arrays.
DirFlag— Business day convention
follow(default) | date character vector with values of
modifiedprevious| cell array of date character vectors with values of
Business day convention, specified date character vector or
cell array of date character vectors with values of
DirFlag can be a scalar, vector, or
matrix of search directions, where Next is
or Previous is
Holiday— Holidays and nontrading-day dates
holidays(default) | serial date number | date character vector | datetime object
Holidays and nontrading-day dates, specified as vector.
All dates in
Holiday must be the same format:
either serial date numbers, or date character vectors, or datetime
arrays. (Using serial date numbers improves performance.)
Weekend— Weekend days
[1 0 0 0 0 0 1](Saturday and Sunday form the weekend) (default) | vector of length 7, containing
1indicates weekend days
Weekend days, specified as a vector of length 7, containing
1 indicates weekend days and the first element
of this vector corresponds to Sunday.