Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

isbusday

True for dates that are business days

Syntax

  • Busday = isbusday(Date)
    example
  • Busday = isbusday(Date,Holiday,Weekend)
    example

Description

example

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

example

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

Examples

collapse all

Determine if Date is a business day.

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

  logical

   0

Determine if a Date vector are business days.

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

  3×1 logical array

   1
   1
   0

Determine if a Date vector are business days using a datetime array.

Date = ['15-feb-2001'; '16-feb-2001'; '17-feb-2001'];
Busday = isbusday(datetime(Date,'Locale','en_US'))
Busday =

  3×1 logical array

   1
   1
   0

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

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

  logical

   1

If the second argument, Holiday, is empty ([ ]), the default Holidays vector (generated with holidays and then associated to the NYSE calendar) is used.

Related Examples

Input Arguments

collapse all

Date being checked, specified as a serial date number, date character vector, or datetime array. 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.

Data Types: double | char | datetime

Holidays and nontrading-day dates, specified as vector.

All dates in Holiday must be the same format: either serial date numbers, or date character vectors, or datetime arrays. (Using serial date numbers improves performance.) The holidays function supplies the default vector.

Data Types: double | char | datetime

Weekend days, specified as a vector of length 7, containing 0 and 1, where 1 indicates weekend days and the first element of this vector corresponds to Sunday.

Data Types: double

Output Arguments

collapse all

Logical true if a business day, returned as a logical true (1) if Date is a business day and logical false (0) otherwise.

Introduced before R2006a

Was this topic helpful?