What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.

  • Profile Image

    How to calculate age from the Date of Birth date field?

    Asked by mamoros on August 25, 2016 at 10:51 PM
    Calculate age from the Date of Birth date field?
  • Profile Image
    JotForm Support

    Answered by Mike_G on August 26, 2016 at 02:37 AM

    To calculate the age, you will be needing two date fields. One date field is where the date of birth is going to be entered and the other one is the one that will hold the current date or date today. You will also be needing a textbox field to display the output(age).

    First, add the fields:

    Then, set a default date(current) for the "Current Date" date field. You should also set the field to hidden.

    After that, create a condition that says, "If the 'Date of Birth' date field is filled, calculate the age". 

    To calculate the Age, subtract the "Date of Birth" date field value from "Current Date" date field value. The difference will be in days, so you need to divide the value by 365.25 days to get the year(s). 

    You also need to get the value rounded down, that is why you will use the "floor()" math function. You need to do that so birthdays in November will not be counted as 1 if it's only August, for example.

    Here's how it is done:

    Here's a screenshot of the condition: 

    I would also suggest you disable future dates for the "Date of Birth" date field.

    Here's a sample form: https://form.jotform.com/62380981430960


    I hope this helps. If you need any further assistance, please contact us anytime. Thank you.