DayRange

DayRange[date1,date2]

gives the dates in the range from date1 to date2.

DayRange[date1,date2,daytype]

gives the dates in the range from date1 to date2 that are of the specified daytype.

Details and Options

  • Dates can be specified in the following forms:
  • DateObject[]date object
    {y,m,d}year, month, day
    {y,m}the first day of the specified month
    {y}the first day of the first month of the year y
    "string"date as a string ("Jan. 1, 2000")
  • DayRange returns a list of DateObject elements.
  • Possible day types are: All (default), "Weekday", "Weekend", Monday through Sunday, "EndOfMonth", "BeginningOfMonth", "BusinessDay", and "Holiday".
  • DayRange takes the following options:
  • CalendarType "Gregorian"calendar in which the dates have been specified
    HolidayCalendar {"UnitedStates","Default"}holiday schedule and subspecification for the business day and holiday computations
    "IncludeEndPoints" {True,True}whether date1 and date2 are to be included in the range
  • In the Jewish calendar, the weekdays are Sunday through Thursday.

Examples

open allclose all

Basic Examples  (4)

Print all the dates in a date range:

Print all dates that fall on a given day of the week:

Print all business days in the date range:

Print all holidays in the current year, subject to the default holiday schedule:

Scope  (1)

Determine the last days of the month:

Options  (4)

CalendarType  (1)

List all US holidays that will occur in the current Islamic calendar year:

HolidayCalendar  (2)

List holidays in India:

Different markets within a country may have different holiday schedules:

"IncludeEndPoints"  (1)

Include the start but not the end date in the range:

Applications  (1)

Compute the number of days until the next US presidential election (first Tuesday after the first Monday in November of leap years):

Properties & Relations  (3)

DayCount is equivalent to the length of the list output by DayRange for the same set of inputs:

DayRange with a day type specification other than All is equivalent to a Select statement:

Weekends, non-weekend holidays, and business days form three non-overlapping sets:

Possible Issues  (1)

A date may only be a holiday if it is not a weekend:

Wolfram Research (2012), DayRange, Wolfram Language function, https://reference.wolfram.com/language/ref/DayRange.html (updated 2014).

Text

Wolfram Research (2012), DayRange, Wolfram Language function, https://reference.wolfram.com/language/ref/DayRange.html (updated 2014).

CMS

Wolfram Language. 2012. "DayRange." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/DayRange.html.

APA

Wolfram Language. (2012). DayRange. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DayRange.html

BibTeX

@misc{reference.wolfram_2024_dayrange, author="Wolfram Research", title="{DayRange}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/DayRange.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_dayrange, organization={Wolfram Research}, title={DayRange}, year={2014}, url={https://reference.wolfram.com/language/ref/DayRange.html}, note=[Accessed: 22-November-2024 ]}