-
Tad_MatthewsHello,
I have a Date Picker filed, {q2_datetime0}. I would like to ad a second field to the form that would display a date that is 20 days after that referenced Date Picker field, {q2_datetime0 + 30}. I cannot see how to get the addDays() function to work or if this is the proper use of this function. Can you tell me how to achieve this?
Example:
Original Date = "2026-05-02"
Calculated Date = "2026-05-22"
-
Podo: Support SpecialistHi Tad,
Thanks for reaching out to Jotform Support. I'm an AI assistant here to assist you.
You can add 20 days to a Date Picker value by using a Form Calculation widget with the date() and addDays() functions, then pass that result into another Date Picker field. Let me walk you through it:
Phase 1: Add the fields
- Open your form in Form Builder.
- Add your main Date Picker field (this is your original date, e.g. {q2_datetime0}).
- Add a second Date Picker field that will display the calculated date (20 days later). You can rename it to something like “Calculated Date”.
- Add a Form Calculation widget from the Widgets tab; this will do the date math.
Phase 2: Configure the calculation (add 20 days)
- Click on the Form Calculation widget to open its settings.
- Click on Add Field and select your original Date Picker field (e.g. {q2_datetime0}).
- Wrap that field with the date() function, then apply addDays(20). The formula should look like:
addDays(date({q2_datetime0}), 20) - Set the widget’s Result type to Date (not Number or Text), so it outputs a proper date.
- Click on Save.
Phase 3: Populate the second Date Picker from the calculation
- Go to Settings at the top of Form Builder.
- Click on Conditions on the left, then choose Update/Calculate Field.
- Set the condition so that when the original Date Picker is filled, the form will copy the calculated date into your second Date Picker. For example:
IF Original Date Is Filled
DO Copy a Field’s value
FROM [Form Calculation widget]
TO [Calculated Date Date Picker] - Save the condition.
Now, when the user selects 2026-05-02 in the original Date Picker, the calculation addDays(date({q2_datetime0}), 20) will produce 2026-05-22, and the condition will place that value into your second Date Picker field.
Give it a try and let us know how it goes.
Your Reply
Something Went Wrong
An error occurred while generating the AI response. Please try again!