Main Content

# days252bus

Number of business days between dates

## Syntax

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

## Description

example

````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. ```

## 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 ```

## Input Arguments

collapse all

Start date, specified as a scalar or an `N`-by-`1` or `1`-by-`N` vector using serial date numbers, a cell array of date character vectors, or datetime array.

Data Types: `double` | `char` | `datetime`

End date, specified as a scalar or an `N`-by-`1` or `1`-by-`N` vector using serial date numbers, a cell array of date character vectors, or datetime array.

Data Types: `double` | `char` | `datetime`

Holidays, specified as a scalar or an `N`-by-`1` or `1`-by-`N` vector using serial date numbers, a cell array of date character vectors, or datetime array.

Data Types: `double` | `char` | `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.

## See Also

### Topics

Introduced before R2006a

Download ebook