Calculate age on a specific date in the current year

  • itdirector830
    Asked on June 2, 2025 at 8:59 AM

    I found this: https://www.jotform.com/answers/666759-calculate-age-on-the-specific-date but it doesn't give me enough information to get what I want. I have a field Date of Birth and want to automatically show AGE on SEPTEMBER 1st, without having to manually change that date in a hidden field each year. Could you assist please?

    My form is https://www.jotform.com/build/220052982523855

  • Sheena JotForm Support
    Replied on June 2, 2025 at 9:11 AM

    Hi itdirector830,

    Thanks for reaching out to Jotform Support. I understand what you’d like to do, but I’ll need a bit of time to work out a solution. I’ll get back to you shortly.

    Thanks for your patience and understanding, we appreciate it.

  • Sheena JotForm Support
    Replied on June 2, 2025 at 10:55 AM

    Hi itdirector830,

    I understand you'd like to calculate the age based on September 1st of the current year, and currently, your form requires you to update the year manually each year. Here's what we can do:

    1. Add a date picker field and set it to the current date. You can hide this field later. Calculate age on a specific date in the current year Image 1 Screenshot 100

    2. We can use our Substring Widget which allows you to separate the characters from the fields. First, you need to get the Date Field ID to use it in the substring widget:

    a. In Form Builder, click on the Gear icon of the Date Field.

    b. Under the Advanced tab, scroll down to the Field ID.

    c. You can find the Field ID for the Day, Month, and Year. Copy the field ID of the year. Calculate age on a specific date in the current year Image 2 Screenshot 111


    Now, Add the Substring widget to your form:

    d. In Form Builder, click on the Add Form Element menu on the left side of the page.

    e. Under the Widget tab, select the Substring widget.

    f. Click on the Wand Icon on the right side of the Substring widget field.

    g. Paste the field id of the year and add the substring start and end characters, then click on Update. Calculate age on a specific date in the current year Image 3 Screenshot 122

    3. Now that we can get the current year, we can create a condition to combine september first and pass it to a date field using conditions.

    a. Add a date field where we can place the combined value.

    Calculate age on a specific date in the current year Image 4 Screenshot 133

    b. In Form Builder, in the orange navigation bar at the top of the page, click on the Settings.

    c. In the menu on the left side of the page, click on Conditions, and then select Update/Calculate Field.

    Calculate age on a specific date in the current year Image 5 Screenshot 144

    d. Create a condition similar to one below:

    Calculate age on a specific date in the current year Image 6 Screenshot 155


    4. Add a date picker field for birthday and a number field for the age.

    Calculate age on a specific date in the current year Image 7 Screenshot 166

    5. Create an UPDATE/CALCULATE condition to calculate for the age.

    Calculate age on a specific date in the current year Image 8 Screenshot 177

    Result:

    Calculate age on a specific date in the current year Image 9 Screenshot 188

    Here's a demo form that you can test and clone to your account.

    Give it a try, and let us know if you need any other help.

  • itdirector830
    Replied on June 2, 2025 at 1:13 PM

    Many thanks - I nearly got there~! However my calculated SEP 1 date comes up as 1964, even though the widget correctly shows 2025 :

    Calculate age on a specific date in the current year Image 1 Screenshot 30

    Here is my condition:

    Calculate age on a specific date in the current year Image 2 Screenshot 41

  • Joeni JotForm Support
    Replied on June 2, 2025 at 1:56 PM

    Hi itdirector830,

    Upon reviewing the screenshot you shared, it looks like your condition is set as Number instead of String. To fix this, click on the calculation formula. You can confirm that it is set as a string when the formula turns gray. Let me show you how:

    1. In Form Builder, click on the Settings tab in the orange navigation bar and select the Conditions tab on the left side menu.
    2. Hover your mouse over to the Pen icon of the condition, and click on the Calculation Formula to convert to from Number to String.
    3. Then, click on the Save button.

    Calculate age on a specific date in the current year Image 1 Screenshot 30 Take a look at the screenshot of the result below:

    Calculate age on a specific date in the current year Image 2 Screenshot 41Give it a try and let us know how it goes.

  • itdirector830
    Replied on June 2, 2025 at 4:25 PM

    Many thanks!!

Your Reply