isbusday

True for dates that are business days

Syntax

Busday = isbusday(Date, Holiday, Weekend)

Arguments

Date

Date(s) being checked. Enter as a vector of serial date numbers or date strings. Date can contain multiple dates, but they must all be in the same format. Dates are assumed to be whole date numbers or date stamps with no fractional or time values.

Holiday

(Optional) Vector of holidays and nontrading-day dates. All dates in Holiday must be the same format: either serial date numbers or date strings. (Using date numbers improves performance.) The holidays function supplies the default vector.

Weekend

(Optional) Vector of length 7, containing 0 and 1, the value 1 indicating weekend days. The first element of this vector corresponds to Sunday. Thus, when Saturday and Sunday form the weekend (default), then Weekend = [1 0 0 0 0 0 1].

Description

Busday = isbusday(Date, Holiday, Weekend) returns logical true (1) if Date is a business day and logical false (0) otherwise.

Examples

Example 1:

Busday = isbusday('16 jun 2001')
Busday =

         0
Date = ['15 feb 2001'; '16 feb 2001'; '17 feb 2001'];
Busday = isbusday(Date)
Busday =

         1
         1
         0

Example 2: Set June 21, 2003 (a Saturday) as a business day.

Weekend = [1 0 0 0 0 0 0];
isbusday('June 21, 2003', [], Weekend)
ans =

     1

    Note:   If the second argument, Holiday, is empty ([ ]), the default Holidays vector (generated with holidays and then associated to the NYSE calendar) is used. To consider a calendar without holidays (except for weekends as controlled by third input), use a serial (or text date) out of your range. For example 0-Jan-0 or the value0 are with high probabilities out of the range. This value overwrites the default calendar allowing you to remove any specific country holiday:

    isbusday(datenum('06092010','ddmmyyyy'),0)
    
    ans =
    
         1
Was this topic helpful?