Main Content

days252bus

Number of business days between dates

Description

NumberDays = days252bus(StartDate,EndDate) computes the number of business days (that is, non-holiday or non-weekend) between the two input dates.

example

NumberDays = days252bus(___HolidayVector) adds an optional argument for HolidayVector. If a holiday vector is not optionally specified, then the holidays.m file is used to determine the holidays.

example

Examples

collapse all

This example shows how to compute the number of business days (i.e. non-holiday or non-weekend) between two dates using the days252bus convention.

NumberDays = days252bus(datetime(2009,1,1), datetime(2009,8,1))
NumberDays = 
146

Input Arguments

collapse all

Start date, specified as a scalar or an N-by-1 or 1-by-N vector using a datetime array, string array, or date character vectors.

To support existing code, days252bus also accepts serial date numbers as inputs, but they are not recommended.

Data Types: double | char | string | datetime

End date, specified as a scalar or an N-by-1 or 1-by-N vector using a datetime array, string array, or date character vectors.

To support existing code, days252bus also accepts serial date numbers as inputs, but they are not recommended.

Data Types: char | string | datetime

Holidays, specified as a scalar or an N-by-1 or 1-by-N vector using a datetime array, string array, or date character vectors.

To support existing code, days252bus also accepts serial date numbers as inputs, but they are not recommended.

Data Types: char | string | datetime

Output Arguments

collapse all

Number of days between two dates, returned as a scalar or an N-by-1 or 1-by-N vector containing the number of days.

Version History

Introduced before R2006a

expand all