Functions Language

DateAdd

The DateAdd() function adds a specified interval to a part of a given date.

Related functions: DatePart


Syntax:

DateAdd(Part, Interval, Date)
  • In the Quintessence Editor (Studio) using Python language, use: Qx.DateAdd()
 See parameter descriptions

PartThe date part to add. Allowed values:
w or week
d or day
m or month
y or year
IntervalA numerical value specifying how many date parts to add.
Use a negative value to subtract date parts.
DateAny valid date.

Examples:

The examples provided below are based on fictitious data for illustrative purposes only.

> Example 1: Add a year and subtract 2 weeks from a given date


Add 1 year to 3 January 2015, then subtract 2 weeks from the result.

Formula:

return := DateAdd("week", -2, Dateadd("y", 1, "3 January 2015")); 

Result:

20 December 2015