How to calculate age base on the date picker field?

  • sweetdreamsutah
    Asked on March 19, 2025 at 7:07 PM

    I have followed every instruction the chat provided to get our date of birth section to auto populate the age, and the formula is not working. If someone can please assist with this it would be greatly appreciated.

  • Rene JotForm Support
    Replied on March 20, 2025 at 1:54 AM

    Hi sweetdreamsutah,

    Thanks for reaching out to Jotform Support. You can set up your form to automatically calculate Age and Age Group. Let me show you how:

    1. Open your form in Form Builder and click on Add Element on the upper-left side of the page.

    2. Under the Basic tab, click on the Date Picker element twice.

    3. Click on the first Date Picker field, and click on the Gear icon to open Date Properties.

    4. In the menu on the right side of the page, click on the Options tab, then click on Current under Default Date.

    How to calculate age base on the date picker field? Image 1 Screenshot 90

    5. Click on the second Date Picker field, and then click on the Gear icon to open Date Properties.

    6. In the menu on the right side of the page, click on the Options tab, then click on Current under Default Date.

    7. Then, click on the Advanced tab, and toggle the Hide field to the On position.

    How to calculate age base on the date picker field? Image 2 Screenshot 101 Next, you'll need to add a Form Calculation widget:

    1. In Form Builder and click on Add Element on the upper-left side of the page.

    2. Click on the Widgets tab, click on the Form Calculation widget to add it to your form.

    How to calculate age base on the date picker field? Image 3 Screenshot 112

    3. Then, set the formula like you see below and click on Save.

    How to calculate age base on the date picker field? Image 4 Screenshot 123

    After that, you’ll also need to add a Short Text element and make it Read Only:

    1.  In Form Builder and click on Add Element on the upper-left side of the page.

    2. Under the Basic tab, scroll down to the Short Text element and click on it to add it to your form.

    3. Click on the Short Text element, and click on the Gear icon to open Short Text Properties.

    4. In the menu on the right side of the page, click on the Advanced tab, and toggle the Read Only to the On position.

    How to calculate age base on the date picker field? Image 5 Screenshot 134 Once done, we need to populate the Short Text element using Update/Calculate Field. Let me show you how: 

    1. In Form Builder, in the orange navigation bar at the top of the page, click on the Settings.

    2. In the menu on the left side of the page, click on Conditions, and then select Update/Calculate Field. (If you already have a condition set, first click on Add Condition, then select Update/Calculate Field.)

    How to calculate age base on the date picker field? Image 6 Screenshot 145

    3. Set the condition like you see below, and click on Save.

    How to calculate age base on the date picker field? Image 7 Screenshot 156

    I set another condition for the Teenager group, just like the Children group, to show you an example. Check out the screencast below to see my results:

    How to calculate age base on the date picker field? Image 8 Screenshot 167 Give it a try and let us know if you have any other questions.

  • sweetdreamsutah
    Replied on March 20, 2025 at 4:28 PM

    I still can't figure out how to get that formula to populate correctly.

  • Lorenz JotForm Support
    Replied on March 20, 2025 at 11:20 PM

    Hi Nicole,

    I assume this is the form 250786101690153 you're working on. I cloned your form, and the calculation indeed don't work. I notice the Form Calculation widget don't work properly with the old theme. Switching to the form's new default theme seems to fix the issue. Let me walk you through it:

    1. In Form Builder, in the right side of the page, click on the Blue Roller Paint icon.

    2. In the Form Designer panel at the right, go to the Themes tab.

    3. Then, hover your mouse over the Default Theme, and click on Use Theme.

    How to calculate age base on the date picker field? Image 1 Screenshot 30

    That's it. The calculation should work after that. Check this out:

    How to calculate age base on the date picker field? Image 2 Screenshot 41

    Give it a try and let us know if you need any more help.