How to Automatically Calculate Age?

  • markyd1976
    Asked on June 5, 2014 at 3:50 PM
    A nice to have would be a Age box along side the applicants date of birth which would be calculated automatically using the current date and tha applicants date of birth. IF this can't be done it is fine, I realised it was on the paper application and it would save someone working out current ages, so no bi issue.
  • Elton Support Team Lead
    Replied on June 5, 2014 at 6:07 PM

    Hi,

    That's possible with calculation.

    Example: http://form.jotformpro.com/form/41556714288967?

    Clone this form so you can figure out the setup. This is done using Date/Time Tool under Quick Tools and a Form Calculation Widget.

    You can check the calculation formula when you open the calculation wizard by clicking the wand icon.

    How to Automatically Calculate Age? Image 1 Screenshot 20

    Notice the Today Date Field and the Days Field are both set as hidden (right click then hide field). They are both used in calculation. First I calculated the days by subtracting the present date to the birth date then divided it with 360 (equivalent for 1 year).

    If you need further assistance, let us know here. 

    Regards!

  • Elton Support Team Lead
    Replied on June 5, 2014 at 7:05 PM

    @markyd1976

    There's a little calculation issue with my first form. Please use the following form instead if you want to clone it to your account.

    http://www.jotformpro.com/form/41557136508961

    On the "Age" field formula, we changed 360 to 365.25 as it's more close to show accurate result.

  • abajan Jotform Support
    Replied on June 5, 2014 at 7:16 PM

    @markyd1976

    There's another issue. Unfortunately, due to something called Epoch Time, this will not work for people born before 1970.

  • jonathan
    Replied on February 4, 2015 at 6:14 PM

    @ EJEPE 

    We will respond to your inquiry here http://www.jotform.com/answers/510073

    Thanks.

  • Benflips
    Replied on July 20, 2016 at 6:57 PM

    Hi.

    Someone gave me this similar workaround a while ago, and I have just played with the cloned form I made, but it doesn't seem to give an accurate result - example, I put in my date of birth 1 Aug 1978 and it said I was 39.

    Now, I WILL be 39 this year, but I am not right now...can the code be tweaked to take account of the days that have elapsed compared with your actual birthday to make sure the result is 100% accurate?

    There is no point using this (otherwise great) code, if the result is off my a year because of the issue as described above.

  • jonathan
    Replied on July 20, 2016 at 9:00 PM

    @ Benflips

    We will resolve your issue separately on this thread https://www.jotform.com/answers/887310

    Thank you.