-
hatzbsAsked 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 -
CharlieReplied on November 11, 2015 at 1: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.
-
hatzbsReplied on November 11, 2015 at 3:23 PM
I am getting this in the age field after the calculation is made:
today - year =
-
hatzbsReplied on November 11, 2015 at 3:45 PMYuch. This is what I get in the age field when I try to run the calculation:
today - year =
... -
Elton Support Team LeadReplied on November 11, 2015 at 4: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.
-
hatzbsReplied on November 11, 2015 at 5:09 PM
Unfortunately, the field is not updating. Doesn't put in the age in the field.
-
hatzbsReplied on November 11, 2015 at 5:17 PM
Well, I got it to work, sort of. :)
-16706 is the value being shown. I'm doing something wrong...
-
Mike_G JotForm SupportReplied on November 11, 2015 at 6: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.
-
hatzbsReplied 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!
-
carolinaruggerfestReplied on March 11, 2017 at 11:26 AM
Just came across this thread as I needed to know how to do this. Thanks Mike_G!
hatzbs -- Not sure how you viewed his response as rude in any way shape or form. There is nothing about the response from Mike_G that even remotely seems rude.