Wolfram Computation Meets Knowledge

Wolfram Language & System Documentation Center Wolfram Language Home Page »

DatePlus

DatePlus[date,n]

gives the date n days after date.

DatePlus[date,{n,step}]

gives the date n calendar steps after date.

DatePlus[date,{{n1,step1},{n2,step2},…}]

gives a date offset by ni steps 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.

Details and Options

Examples

open allclose all

Basic Examples  (5)

Add 35 days to January 1, 2017:

Use a date string as input:

Subtract 35 days from a date:

Add 14 weeks to a date:

Add 34 days to the current date:

Scope  (13)

Date Formats  (5)

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:

Increments  (8)

Add 10 months to a date:

Add 40 weeks to a date:

Add 7 weeks and 2 days:

Add 1 year to a date list:

Add 1 month and 15 days to the specified date:

The increment can be specified using the quantity framework:

Add 2.45 days:

Subtract 4.6 hours:

Options  (7)

CalendarType  (2)

Advance a date in the Jewish calendar:

Islamic years are shorter than Gregorian years:

HolidayCalendar  (2)

Compare the dates 250 business days away in different countries:

Different markets within a country may have different holiday schedules:

Method  (3)

By default, adding a month to May 31 will roll back to June 30:

Using Method"RollForward" will roll forward to the next valid date, July 1:

DatePlus[date,"Year"] will move forward 365 or 366 days, depending on the year:

Quantity[1,"Years"] is equivalent to Quantity[365,"Days"] in the Quantity framework:

Therefore Method"Continuous" will always add 365 days:

Compare the results of different arithmetic methods when adding a month to January 30, 2021:

Compare the results of different rolling methods for January 27 through February 1:

Applications  (1)

Add increasing powers of 10 in seconds starting from the beginning of year 2000:

Properties & Relations  (2)

DatePlus adds calendar steps to dates, while DateDifference computes time distances between dates:

The inverse relationship:

Use $DateStringFormat to set the default format for date strings:

Possible Issues  (3)

Dates can be ambiguous:

Use DateList to disambiguate between different interpretations:

When list increments are specified, they are added from highest order to lowest:

The order in which calendar units are added can change the results of arithmetic operations, due to variable lengths for months and years:

Wolfram Research (2007), DatePlus, Wolfram Language function, https://reference.wolfram.com/language/ref/DatePlus.html (updated 2023).

Text

Wolfram Research (2007), DatePlus, Wolfram Language function, https://reference.wolfram.com/language/ref/DatePlus.html (updated 2023).

CMS

Wolfram Language. 2007. "DatePlus." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/DatePlus.html.

APA

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

BibTeX

@misc{reference.wolfram_2024_dateplus, author="Wolfram Research", title="{DatePlus}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/DatePlus.html}", note=[Accessed: 18-May-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_dateplus, organization={Wolfram Research}, title={DatePlus}, year={2023}, url={https://reference.wolfram.com/language/ref/DatePlus.html}, note=[Accessed: 18-May-2024 ]}

Top