I have a DOB box in my form. Is it possible to auto-calculate age?

  • Profile Image
    adminocrda
    Asked on March 16, 2021 at 09:51 AM

    Is there a way to make the submission show the DOB and convert that into the end user's age at submission please? I have the DOB box in my form, but can't work out the rest.

    Thanks

  • Profile Image
    roneet
    Answered on March 16, 2021 at 12:02 PM

    You can calculate the Age this way:

    1615910365_6050d5dda3d4d_

    You can add a Form Calculation widget and then calculate the difference between the current and Birthdate field.

    You need to add another Date Picker widget and calculate the current date.

    Let us know the form where you want to insert the logic?

    Thanks.

  • Profile Image
    adminocrda
    Answered on March 16, 2021 at 02:06 PM

    Thank you!. I've replicated what you have shown, except the word floor as I can't work out what that would be in my form. It is currently looking to be 6 months adrift and calculating me to be 6 months older than I am.


    My form is: https://form.jotform.com/adminocrda/Under18LicenceApplication2021


    Thanks for your help!

  • Profile Image
    Kevin_G
    Answered on March 16, 2021 at 07:57 PM

    The floor function needs to be added through the widget, kindly check this guide for more details: https://www.jotform.com/help/267-form-calculation-math-function-reference

    If you have any questions, let us know.

    Thanks.

  • Profile Image
    adminocrda
    Answered on March 17, 2021 at 01:27 PM

    Good Afternoon

    My condition is now set exactly as the one you have provided, including floor, but it is still calculating me to be older than I am. So it is now rounding down to a whole year, but the calculation is a year over what it should be.


    Thanks

  • Profile Image
    adminocrda
    Answered on March 17, 2021 at 01:34 PM

    I've found the issue. After much googling to find the actual calculation and not an excel formula, the last part of what you sent me needs to be 365.2422 Those 2 x 2s are very important it seems!


    Thanks for your help