This article requires the GP Date Time Calculator perk. Buy Gravity Perks today to get this perk plus 33 other premium Gravity Forms plugins!
One of the most common fields we see on forms is a date of birth field. With the user’s date of birth you are able to calculate their age and with their age you can implement a variety of powerful interactions.
- Restrict registration to users above a certain age.
- Provide lower product pricing to children and seniors (see our Aged-based Pricing article).
- Send promotional emails to customers on their birthday, personalized to their specific age.
In this tutorial, you’ll learn how easy it is to calculate a customer’s age from their date of birth using Gravity Forms Date Time Calculator.
Steps
Step 1 – Add a Date of Birth Field
Add a Date field to your form, call it “Date of Birth”, and set your desired date format.

Step 2 – Calculate Age
Add a Number field to the form and name it “Age”. In the Formula box, insert the merge tag for the Date of Birth field
and add the :age
merge tag modifier to it. In this example, my Date of Birth field ID is “1”.

You’re done! Your Number field will automatically display the customer’s age based on the date entered in the Date of Birth field.
:age
merge tag modifier will always return the age in years, regardless of the Date Calculation Unit setting in
the Number field.
Steps Beyond
Once you have set up the fields to calculate your customer’s age, the possibilities are endless. Use age with conditional logic, for example to hide the submit button unless the customer is above or below a certain age.

You can also set up pricing or discounts based on their age. For example, to offer senior discounts. Follow the steps in our How to Set Up Age Based Pricing to learn more.
Questions? Comments?
Do you have questions or comments about this tutorial? We’d love to hear them!
Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 32+ essential add-ons for Gravity Forms with support you can count on.
Calculate age in year and month. currently it is showing year only . we need year and remaining months for the age
Hello Prakash, Do you currently have Gravity Forms Date Time Calculator installed? If so, could you please drop us a support request and we could take a closer look at your forms setup? Thank you! ๐
Hi i want to caclculate the age in my gravityform. Please let me know how can i find?
Hello Mughees, You need to download our Gravity Perks Date Time Calculator. This would require a Gravity Perks license to activate. Once you have that perk, this tutorial will work for you. ๐ Let us know if you have any other questions.
Hi there, It’s not working. it’s showing the whole date as a number rather years
Hello Asif, Do you currently have Gravity Forms Date Time Calculator installed? If so, could you please drop us a support request and we could take a closer look at your forms setup? Thank you! ๐
How would we ensure this number field containing their age is automatically updated as time goes by and they get older? Does Gravity Forms do this by default or do we need to trigger it some how?
Hi. I never did get a response to this question. I certainly would appreciate one!
Thanks,
Michael
Hello Michael, Sorry for the delayed response on this one. The field will continue to update based on the input within the date field. Once the item is submitted, the birthday that was submitted will remain as the entry and they will have to resubmit for a new birthday age entry. Let us know if you have any other questions. ๐
How would I go about checking the age on a future date e.g. 11/4/2020 How would I go about doing this? The above method works out the age based on today.
Thanks
Hi Faaiza, you can subtract the future date from their birthdate to get the number of years between those dates which would be their age.
Example:
{Future Date:3} - {Birthdate:1}