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

    Calculate Age based on birth date

    Asked by hatzbs on November 11, 2015 at 11:39 AM

    I would like to calculate age. For instance, I have a Date of Birth field, and an age field. I would like to automatically calculate the age of the person based on the Date of Birth. I attempted to use the calculate field, but I am sadly lost. :(

     

    Assistance would be greatly appreciated. 

    Page URL:
    https://form.jotform.com/52723286884163

    calculate age date of birth
  • Profile Image
    JotForm Support

    Answered by Charlie on November 11, 2015 at 01:39 PM

    I'm unable to understand properly the form you have. But you can try this sample form that I made: https://form.jotform.com/53144880775968?. To calculate the age based from the date of birth, here are the steps:

    1. First, have two Datetime field. The 1st one will get the current date while the other is for the date of birth.

    2. Add a form calculation widget as the age field. We will do the calculation there.

    3. In my form calculation widget, this is the formula I have.

    floor((current date - date of birth)  / 365 days)

    floor - this will round your number value downward. You can check this link for the reference: http://www.jotform.com/help/267-Form-Calculation-Math-Function-Reference 

     

    Let us know if that works.

  • Profile Image

    Answered by hatzbs on November 11, 2015 at 03:23 PM

    I am getting this in the age field after the calculation is made:

     

    today - year =

  • Profile Image

    Answered by hatzbs on November 11, 2015 at 03:45 PM
    Yuch. This is what I get in the age field when I try to run the calculation:
    today - year =
    ...
  • Profile Image
    JotForm Support

    Answered by EltonCris on November 11, 2015 at 04:52 PM

    It is because of your update a field value condition with just "today - year =" text in the formula. I have now updated it for you. Check the age calculation in your form now. It should now be working.

  • Profile Image

    Answered by hatzbs on November 11, 2015 at 05:09 PM

    Unfortunately, the field is not updating. Doesn't put in the age in the field. 

  • Profile Image

    Answered by hatzbs on November 11, 2015 at 05:17 PM

    Well, I got it to work, sort of. :)

     

    -16706 is the value being shown. I'm doing something wrong... 

  • Profile Image
    JotForm Support

    Answered by Mike_G on November 11, 2015 at 06:19 PM

    it is because you lack condition brackets in the formula of your condition. Here's how your condition looks like: 

    Here's how it should look like. 

    I hope this helps. Let us know if you need any further assistance. Thank you. 

  • Profile Image

    Answered by hatzbs on November 11, 2015 at 10:00 PM

    Hi, are you on the support team? I don't think so, so your rude comments are not welcome. If you are on the support team, then I will be double thinking my subscription to your product.

    With that being said, it works. Many thanks to the support team for your assistance!