Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

holidays

Holidays and nontrading days

Syntax

  • H = holidays
    example
  • H = holidays(StartDate,EndDate)
    example
  • H = holidays(StartDate,EndDate,AltHolidays)
    example

Description

example

H = holidays returns a vector of serial date numbers corresponding to all holidays and nontrading days.

example

H = holidays(StartDate,EndDate) returns a vector of serial date numbers corresponding to the holidays and nontrading days betweenStartDate and EndDate, inclusive.

example

H = holidays(StartDate,EndDate,AltHolidays) returns a vector of serial date numbers corresponding to the alternate list of holidays and nontrading days.

Examples

collapse all

Create a vector of serial date numbers corresponding to all holidays and nontrading dates between a specified StartDate and EndDate:

H = holidays('jan 1 2001', 'jun 23 2001')
datestr(H)
H =

      730852
      730866
      730901
      730954
      730999


ans =

01-Jan-2001
15-Jan-2001
19-Feb-2001
13-Apr-2001
28-May-2001

Alternatively, using a datetime array for StartDate and EndDate returns a datetime array for H.

H = holidays(datetime('1-Jan-2001','Locale','en_US'),...
datetime('23-Jun-2001','Locale','en_US'))
H = 

  5×1 datetime array

   01-Jan-2001
   15-Jan-2001
   19-Feb-2001
   13-Apr-2001
   28-May-2001

Related Examples

Input Arguments

collapse all

Start date, specified using a serial date number, date character vector, or datetime array.

Data Types: double | char | datetime

End date, specified using a serial date number, date character vector, or datetime array.

Data Types: double | char | datetime

Alternate list of holidays and nontrading days, specified using a serial date number, date character vector, or datetime array.

Data Types: double | char | datetime

Output Arguments

collapse all

Dates corresponding to all holidays and nontrading days, returned as a vector of dates. If StartDate, EndDate, and AltHolidays are all either serial date numbers or date character vectors, H is returned as serial date numbers. If either StartDate, EndDate, or AltHolidays are datetime arrays, H is returned as a datetime array.

More About

collapse all

Definition of holidays

holidays is based on a modern 5-day workweek. This function contains all holidays and special nontrading days for the New York Stock Exchange from January 1, 1885 to December 31, 2050.

Since the New York Stock Exchange was open on Saturdays before September 29, 1952, exact closures from 1885 to 2070 should include Saturday trading days. To capture these dates, use the function nyseclosures. The results from holidays and nyseclosures are identical if the WorkWeekFormat in nyseclosures is 'Modern'.

Introduced before R2006a

Was this topic helpful?