DatePlus

DatePlus[date, n]
gives the date n days after date.

DatePlus[date, {n, "unit"}]
gives the date n units after date.

DatePlus[date, {{n1, "unit1"}, {n2, "unit2"}, ...}]
gives a date offset by units of each specified size.

DatePlus[n]
gives the date n days after the current date.

DatePlus[offset]
gives the date with the specified offset from the current date.

DetailsDetails

  • DatePlus[date, -n] gives the date n days before date.
  • Dates can be specified in the following forms:
  • {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 ()
    {y,m,d,h,m,s}precise time
    timeabsolute time specification
  • Possible offset units are , , , , , , , .
  • is taken to be equivalent to etc.
  • DatePlus[date, offset] gives results in the same general format as date.
  • When date is a list, the result has the same length as date, possibly extended to include the smallest unit in offset. »
  • When date is a string, the result is in the form specified by $DateStringFormat.

ExamplesExamplesopen allclose all

Basic Examples (5)Basic Examples (5)

Add 35 days to January 1, 2009:

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

Use a date string as input:

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

Subtract from a date:

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

Add 14 weeks to a date:

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

Add 34 days to the current time:

In[1]:=
Click for copyable input
Out[1]=
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »