Documentation Center

  • Trial Software
  • Product Updates

fbusdate

First business date of month

Syntax

Date = fbusdate(Year, Month, Holiday, Weekend)

Arguments

Year

Enter as four-digit integer.

Month

Enter as integer from 1 to 12.

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

Date = fbusdate(Year, Month, Holiday, Weekend) returns the serial date number for the first business date of the given year and month. Holiday specifies nontrading days.

Year and Month can contain multiple values. If one contains multiple values, the other must contain the same number of values or a single value that applies to all. For example, if Year is a 1-by-n vector of integers, then Month must be a 1-by-n vector of integers or a single integer. Date is then a 1-by-n vector of date numbers.

Use the function datestr to convert serial date numbers to formatted date strings.

Examples

expand all

Return a Serial Date Number for the First Business Date

This example shows how to return serial date numbers for the first business date, given year and month.

Date = fbusdate(2001, 11)
datestr(Date)

Year = [2002 2003 2004];
Date = fbusdate(Year, 11)
datestr(Date)
Date =

      731156


ans =

01-Nov-2001


Date =

      731521      731888      732252


ans =

01-Nov-2002
03-Nov-2003
01-Nov-2004

Return a Serial Date Number for the First Business Date Using the Weekend Argument

This example shows how to return serial date numbers for the first business date, given year and month, and also indicate that Saturday is a business day by setting the Weekend argument. March 1, 2003, is a Saturday. Use fbusdate to check that this Saturday is actually the first business day of the month.

Weekend = [1 0 0 0 0 0 0];
Date = datestr(fbusdate(2003, 3, [], Weekend))
Date =

01-Mar-2003

See Also

| | | |

Was this topic helpful?