DateRange

DateRange[date1,date2]
gives all dates in the range from to .

DateRange[date1,date2,increment]
gives the date lists in the range from to that are increment apart.

Details and OptionsDetails and Options

  • Dates can be specified in the following forms:
  • DateObject[]date object
    {y,m,d,h,m,s}precise time
    {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 ()
    timeabsolute time specification
  • is taken to be equivalent to etc.
  • Possible increments are denominated in the following units: , , , , , , , .
  • Mixed-radix increments are permitted.
  • An increment may be specified using the Quantity framework.
  • DateRange takes the following option:
  • CalendarType"Gregorian"calendar in which the date parameters have been specified

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Print all the dates in a date range:

In[1]:=
Click for copyable input
Out[1]=

Increment dates by one week:

In[1]:=
Click for copyable input
Out[1]=

Increment dates by one year, one month, and one day:

In[1]:=
Click for copyable input
Out[1]=

DateRange has constraints similar to Range:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2012
(9.0)
| Updated in 2014
(10.0)