Business days in serial date format


bdates = busdays(sdate, edate, bdmode)
bdates = busdays(sdate, edate, bdmode, holvec)



Start date, specified as a serial date number, date character vector, or datetime array.


End date, specified as a serial date number, date character vector, or datetime array.


(Optional) Frequency of business days:

  • DAILY, Daily, daily, D, d, 1 (default)

  • WEEKLY, Weekly, weekly, W, w, 2

  • MONTHLY, Monthly, monthly, M, m, 3

  • QUARTERLY, Quarterly, quarterly, Q, q, 4

  • SEMIANNUAL, Semiannual, semiannual, S, s, 5

  • ANNUAL, Annual, annual, A, a, 6

Character vectors must be enclosed in single quotation marks.


(Optional) Holiday dates, specified as a vector in date character vector, serial date, or datetime array format. Using a holvec value of NaN uses a holiday list that has no dates.


bdates = busdays(sdate, edate, bdmode) generates a vector of business days, bdates, in serial date format between the last business date of the period that contains the start date, and the last business date of period that contains the end date. If holvec is not supplied, the dates are generated based on United States holidays. If you do not supply bdmode, busdays generates a daily vector.

For example:

vec = datestr(busdays('1/2/01','1/9/01','weekly'))
vec =

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.

bdates = busdays(sdate, edate, bdmode, holvec) lets you supply a vector of holidays, holvec, used to generate business days. holvec can either be in serial date format or date character vector format. If you use this syntax, you must supply the frequency bdmode.

The output, bdates, is a column vector of business dates in serial date format.

Setting holvec to '' (empty character vector) or [] (empty vector) results in BUSDAYS using a default holiday schedule. The default holiday schedule is the NYSE holiday schedule.

If both sdate, edate, and holvec are all either serial date numbers or date character vectors, bdates is returned as a serial date number

However, if either sdate, edate, or holvec are datetime arrays, bdates is returned as a datetime array.

For example:

vec = busdays(datetime('2-Jan-2001','Locale','en_US'),'9-Jan-2001','weekly')
vec = 

See Also


Related Examples

Introduced before R2006a

Was this topic helpful?