addDays( )

Add a specific number of days to a date value.

Syntax

Tip:

This function is useful when you need to evaluate if a date is exceeded by a specific amount of time.

This function is used with variables of type date that do not contain time elements. When using a date/time type parameter, function considers only date part and ignores time elements.

Tip:

You can use the addTimeInHours( ) or addTimeInMinutes( ) helper functions to work with date and time elements.
addDays(startDate, numberOfDays)

Parameters

Parameter Required/Optional Description
startTime Required Date or date/time value to add days to.
numberOfDays Required Number of days to be added to the passed in date.

Return value

A new date value increased by the number of days specified.

Examples

Example 3-32 date1 cannot be greater than 7 days from date2

// Given 2 form questions of type Date are defined in the rule as variables
if (addDays(dateTime1, 7) > dateTime2) {
  return false;
} else {
  return true;
}
 
// triggers query that dateTime1 cannot be > 7 days from dateTime2