Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Data Manipulation > Date & Time >

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 ni 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.
  • 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 ("Jan. 1, 2000")
{y,m,d,h,m,s}precise time
timeabsolute time specification
  • Possible offset units are "Year", "Quarter", "Month", "Week", "Day", "Hour", "Minute", "Second".
  • {y, m, d} is taken to be equivalent to {y, m, d, 0, 0, 0}, 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.  »
Add 35 days to January 1, 2009:
Use a date string as input:
Subtract from a date:
Add 14 weeks to a date:
Add 34 days to the current time:
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]=
DatePlus can take dates in the standard {y, m, d, h, m, s} format of DateList:
DatePlus can take dates in any format supported by DateString:
If a date is given as {y, m, d}, DatePlus returns in the same form:
{y, m} is interpreted as the first day of the specified month:
{y} is interpreted as January 1 of the specified year:
Add 10 months to a date:
Add 40 weeks to a date:
Add 7 weeks and 2 days:
Lists are extended to include smaller offset units:
Add 1 year to a date list:
Add 1 month and 15 days to the specified date list:
Add 2.45 days:
Subtract 4.6 hours:
DatePlus adds time units to dates, while DateDifference computes units between dates:
The inverse relationship:
Use $DateStringFormat to set the default format for date strings:
Dates can be ambiguous:
Use DateList to disambiguate between different interpretations:
New in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team