NexJ Logo

DateAddDays()

Adds the specified number of days to a date. This function takes a date, integer, and string value as arguments and returns a date value.

Syntax

DateAddDays(date, days, time_zone)

Input

date

date

The date to add days to.

days

integer

The number of days to add to the date.

time_zone

string

(Optional) The time zone code. This argument specifies the time zone of the date. For example, if you want the date to be in Eastern Standard Time (EST), enter the time zone argument "EST". If you do not specify a time zone, the local time zone of the user who is completing the form is used.

Output

date

Examples

Assume that you have a form in which there is a date field question with the reference name date_to_shift, and a number field question with the reference name days_to_add. The user is in the EST time zone. In the number field, the user enters 10. In the date field, the user chooses the date January 31, 2000.

  • The expression DateAddDays($date_to_shift, $days_to_add) returns a date value that represents February 10, 2000 12:00 AM EST.
  • The expression DateAddDays($date_to_shift, $days_to_add, "PST") returns a date value that represents February 9, 2000 9:00 PM PST.

Time zones