Documentation

# days252bus

Number of business days between dates

## Syntax

```NumberDays = days252bus(StartDate,EndDate)
NumberDays = days252bus(StartDate,EndDate,HolidayVector)
```

## Arguments

 `StartDate` `N`-by-`1` or `1`-by-`N` vector or scalar value, in serial date number, date character vector, or datetime array form, representing the start date. `EndDate ` `N`-by-`1` or `1`-by-`N` vector or scalar value, in serial date number, date character vector, or datetime array form, representing the end date. `HolidayVector` (Optional) `N`-by-`1` or `1`-by-`N` vector, in serial date number, date character vector, or datetime array form, representing holidays.

## Description

`NumberDays = days252bus(StartDate,EndDate,HolidayVector)` computes the number of business days (that is, non-holiday or non-weekend) between the two input dates. Note that a holiday vector may be optionally specified; if it is not, then the `holidays.m` file is used to determine the holidays.

`days252bus` returns `NumberDays`, a `N`-by-`1` or `1`-by-`N` vector or scalar value for the number of days between two dates. `NumberDays` returns as a double for serial date number, date character vector, and datetime inputs.

## 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('1/1/2009', '8/1/2009')`
```NumberDays = 146 ```

This example shows how to compute the number of business days (i.e. non-holiday or non-weekend) between two dates, specified as a datetime array, using the `days252bus` convention.

`NumberDays = days252bus(datetime('1-Jan-2009','Locale','en_US'), '8/1/2009')`
```NumberDays = 146 ```