---
title: "DayRange"
language: "en"
type: "Symbol"
summary: "DayRange[date1, date2] gives the dates in the range from date 1 to date 2. DayRange[date1, date2, daytype] gives the dates in the range from date 1 to date 2 that are of the specified daytype."
keywords: 
- dates
- finance
- holidays
- holiday calendar
- business days
- islamic calendar
- jewish calendar
- gregorian
- julian
canonical_url: "https://reference.wolfram.com/language/ref/DayRange.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Date & Time"
    link: "https://reference.wolfram.com/language/guide/DateAndTime.en.md"
related_functions: 
  - 
    title: "DateRange"
    link: "https://reference.wolfram.com/language/ref/DateRange.en.md"
  - 
    title: "DayPlus"
    link: "https://reference.wolfram.com/language/ref/DayPlus.en.md"
  - 
    title: "DayMatchQ"
    link: "https://reference.wolfram.com/language/ref/DayMatchQ.en.md"
  - 
    title: "DayCount"
    link: "https://reference.wolfram.com/language/ref/DayCount.en.md"
---
# 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

* ``DayRange`` returns a list of ``DateObject`` elements.

* A date 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}                | January 1 of the year y              |
| "string"           | date as a string ("Jan. 1, 2000")    |
| {y, m, d, h, m, s} | precise time                         |
| time               | absolute time specification          |

* Possible day types are:

|                     |                                      |
| ------------------- | ------------------------------------ |
| All                 | any calendar date (default)          |
| "Weekday"           | date considered a weekday            |
| "Weekend"           | date considered a weekend            |
| "Holiday"           | holiday according to HolidayCalendar |
| "NonHoliday"        | date that is not a holiday           |
| "BusinessDay"       | non-holiday weekday                  |
| "NonBusinessDay"    | holiday or weekend                   |
| "WeekdayHoliday"    | holiday on a weekday                 |
| "WeekendHoliday"    | holiday on a weekend                 |
| "WeekendNonHoliday" | non-holiday weekend                  |
| Monday, Tuesday, …  | a specific day of the week           |
| "EndOfMonth"        | final day of a given month           |
| "BeginningOfMonth"  | first day of a given month           |

* In the Jewish calendar, the weekdays are ``Sunday`` through ``Thursday``.

* ``DayRange`` takes the following options:

|                    |                             |                                                                                     |
| ------------------ | --------------------------- | ----------------------------------------------------------------------------------- |
| CalendarType       | Automatic                   | 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                             |

---

## Examples (14)

### Basic Examples (4)

Print all the dates in a date range:

```wl
In[1]:= DayRange[Yesterday, Tomorrow]

Out[1]= {DateObject[{2022, 2, 2}, "Day"], DateObject[{2022, 2, 3}, "Day"], DateObject[{2022, 2, 4}, "Day"]}
```

---

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

```wl
In[1]:= With[{first = Take[DateList[], 2]}, DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], Sunday]]

Out[1]= {DateObject[{2022, 2, 6}, "Day"], DateObject[{2022, 2, 13}, "Day"], DateObject[{2022, 2, 20}, "Day"], DateObject[{2022, 2, 27}, "Day"]}
```

---

Print all business days in the date range:

```wl
In[1]:= DayRange[DateObject[{2022, 1, 1}], DateObject[{2022, 1, 31}], "BusinessDay"]

Out[1]= {DateObject[{2022, 1, 3}, "Day"], DateObject[{2022, 1, 4}, "Day"], DateObject[{2022, 1, 5}, "Day"], DateObject[{2022, 1, 6}, "Day"], DateObject[{2022, 1, 7}, "Day"], DateObject[{2022, 1, 10}, "Day"], DateObject[{2022, 1, 11}, "Day"], DateObject[{20 ... , "Day"], DateObject[{2022, 1, 21}, "Day"], DateObject[{2022, 1, 24}, "Day"], DateObject[{2022, 1, 25}, "Day"], DateObject[{2022, 1, 26}, "Day"], DateObject[{2022, 1, 27}, "Day"], DateObject[{2022, 1, 28}, "Day"], DateObject[{2022, 1, 31}, "Day"]}
```

---

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

```wl
In[1]:= With[{firstday = DayRound[CurrentDate["Year"]]}, DayRange[firstday, DatePlus[firstday, {{1, "Year"}, {-1, "Day"}}], "Holiday"]]

Out[1]= {DateObject[{2022, 1, 17}, "Day"], DateObject[{2022, 2, 21}, "Day"], DateObject[{2022, 5, 30}, "Day"], DateObject[{2022, 7, 4}, "Day"], DateObject[{2022, 9, 5}, "Day"], DateObject[{2022, 10, 10}, "Day"], DateObject[{2022, 11, 11}, "Day"], DateObject[{2022, 11, 24}, "Day"], DateObject[{2022, 12, 26}, "Day"]}
```

### Scope (1)

Determine the last days of the month:

```wl
In[1]:= With[{first = Take[DateList[], 1]}, DayRange[first, DatePlus[first, {{1, "Year"}, {-1, "Day"}}], "EndOfMonth"]]

Out[1]= {DateObject[{2014, 1, 31}, CalendarType -> "Gregorian"], DateObject[{2014, 2, 28}, CalendarType -> "Gregorian"], DateObject[{2014, 3, 31}, CalendarType -> "Gregorian"], DateObject[{2014, 4, 30}, CalendarType -> "Gregorian"], DateObject[{2014, 5, 31 ... ype -> "Gregorian"], DateObject[{2014, 9, 30}, CalendarType -> "Gregorian"], DateObject[{2014, 10, 31}, CalendarType -> "Gregorian"], DateObject[{2014, 11, 30}, CalendarType -> "Gregorian"], DateObject[{2014, 12, 31}, CalendarType -> "Gregorian"]}
```

### Options (4)

#### CalendarType (1)

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

```wl
In[1]:= With[{first = {Nest[First, DateObject[CalendarType -> "Islamic"], 2]}}, DayRange[first, DatePlus[first, {{1, "Year"}, {-1, "Day"}}], "Holiday", CalendarType -> "Islamic"]]

Out[1]= {DateObject[{1435, 1, 8}, CalendarType -> "Islamic"], DateObject[{1435, 1, 25}, CalendarType -> "Islamic"], DateObject[{1435, 2, 22}, CalendarType -> "Islamic"], DateObject[{1435, 2, 29}, CalendarType -> "Islamic"], DateObject[{1435, 3, 19}, Calend ... 7}, CalendarType -> "Islamic"], DateObject[{1435, 7, 27}, CalendarType -> "Islamic"], DateObject[{1435, 9, 7}, CalendarType -> "Islamic"], DateObject[{1435, 11, 7}, CalendarType -> "Islamic"], DateObject[{1435, 12, 19}, CalendarType -> "Islamic"]}
```

#### HolidayCalendar (2)

List holidays in India:

```wl
In[1]:= DayRange[{2012}, {2012, 12, 31}, "Holiday", HolidayCalendar -> "India"]

Out[1]= {DateObject[{2012, 1, 26}, CalendarType -> "Gregorian"], DateObject[{2012, 3, 7}, CalendarType -> "Gregorian"], DateObject[{2012, 3, 8}, CalendarType -> "Gregorian"], DateObject[{2012, 4, 5}, CalendarType -> "Gregorian"], DateObject[{2012, 4, 6}, C ... pe -> "Gregorian"], DateObject[{2012, 10, 26}, CalendarType -> "Gregorian"], DateObject[{2012, 11, 14}, CalendarType -> "Gregorian"], DateObject[{2012, 11, 28}, CalendarType -> "Gregorian"], DateObject[{2012, 12, 25}, CalendarType -> "Gregorian"]}
```

---

Different markets within a country may have different holiday schedules:

```wl
In[1]:= CalendarData["UnitedStates"]

Out[1]= {"Default", "GovernmentBond", "NERC", "NYSE"}

In[2]:= With[{first = {2012, 4}}, DayRange[first, DatePlus[first, {{1, "Month"}}], "Holiday", HolidayCalendar -> {"UnitedStates", "NYSE"}]]

Out[2]= {DateObject[{2012, 4, 6}, CalendarType -> "Gregorian"]}

In[3]:= With[{first = {2012, 4}}, DayRange[first, DatePlus[first, {{1, "Month"}}], "Holiday"]]

Out[3]= {}
```

#### "IncludeEndPoints" (1)

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

```wl
In[1]:= With[{first = Take[DateList[], 2]}, DayRange[first, DatePlus[first, {{1, "Week"}}], "IncludeEndPoints" -> {True, False}]]

Out[1]= {DateObject[{2014, 5, 1}, CalendarType -> "Gregorian"], DateObject[{2014, 5, 2}, CalendarType -> "Gregorian"], DateObject[{2014, 5, 3}, CalendarType -> "Gregorian"], DateObject[{2014, 5, 4}, CalendarType -> "Gregorian"], DateObject[{2014, 5, 5}, CalendarType -> "Gregorian"], DateObject[{2014, 5, 6}, CalendarType -> "Gregorian"], DateObject[{2014, 5, 7}, CalendarType -> "Gregorian"]}
```

### Applications (1)

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

```wl
In[1]:=
nextelection[date_] := Module[{year = 4Ceiling[date[[1]] / 4], nearest}, 
	nearest = DatePlus[DayRange[{year, 11, 1}, {year, 11, 30}, Monday][[1]], 1];
	If[QuantityMagnitude[DateDifference[date, nearest]] > 0, DayCount[date, nearest], DayCount[date, DatePlus[DayRange[{year + 4, 11, 1}, {year + 4, 11, 30}, Monday][[1]], 1]]]//Floor];
nextelection[DateList[]]

Out[1]= 602
```

### Properties & Relations (3)

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

```wl
In[1]:= With[{first = Take[DateList[], 2]}, Length[DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "BusinessDay", "IncludeEndPoints" -> {False, True}]] == DayCount[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "BusinessDay"]]

Out[1]= True
```

---

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

```wl
In[1]:= DayRange[{2022}, {2023}, "Weekend"] == Select[DayRange[{2022}, {2023}], DayMatchQ[#, "Weekend"]&]

Out[1]= True
```

---

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

```wl
In[1]:= With[{sets = {DayRange[{2022}, {2023}, "Holiday"], DayRange[{2022}, {2023}, "Weekend"], DayRange[{2022}, {2023}, "BusinessDay"]}}, Union@@sets == ((Join@@sets)//Sort)]

Out[1]= True
```

### Possible Issues (1)

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

```wl
In[1]:= With[{first = {2012, 7}}, DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "Weekend"]]

Out[1]= {DateObject[{2012, 7, 1}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 7}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 8}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 14}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 15}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 21}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 22}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 28}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 29}, CalendarType -> "Gregorian"]}

In[2]:= With[{first = {2012, 7}}, DayRange[first, DatePlus[first, {{1, "Month"}, {-1, "Day"}}], "Holiday", HolidayCalendar -> {"Gregorian" -> {{True&, # == 7&, 1 ≤ # ≤ 31&}}}]]

Out[2]= {DateObject[{2012, 7, 2}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 3}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 4}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 5}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 6}, Ca ... arType -> "Gregorian"], DateObject[{2012, 7, 26}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 27}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 30}, CalendarType -> "Gregorian"], DateObject[{2012, 7, 31}, CalendarType -> "Gregorian"]}
```

## See Also

* [`DateRange`](https://reference.wolfram.com/language/ref/DateRange.en.md)
* [`DayPlus`](https://reference.wolfram.com/language/ref/DayPlus.en.md)
* [`DayMatchQ`](https://reference.wolfram.com/language/ref/DayMatchQ.en.md)
* [`DayCount`](https://reference.wolfram.com/language/ref/DayCount.en.md)

## Related Guides

* [Date & Time](https://reference.wolfram.com/language/guide/DateAndTime.en.md)

## Related Links

* [An Elementary Introduction to the Wolfram Language: Dates and Times](https://www.wolfram.com/language/elementary-introduction/19-dates-and-times.html)

## History

* [Introduced in 2012 (9.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn90.en.md) \| [Updated in 2014 (10.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn100.en.md) ▪ [2025 (14.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn143.en.md)