Adds the specified number of hours to a date. This function takes a date, integer, and string value as arguments and returns a date value.
DateAddHours(<date>, <hours>, <time_zone>)
The date to add hours to.
The number of hours to add to the date.
(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.
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 hours_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 DateAddHours($date_to_shift, $hours_to_add) returns a date value that represents January 31, 2000 10:00 AM EST.
- The expression DateAddHours($date_to_shift, $hours_to_add, "PST") returns a date value that represents January 31, 2000 7:00 AM PST.