Find trending topics and quick answers here

Hi, how can we help?

Search by task, feature, or problem—not just a single keyword.

There no matching results.

Can my online form calculate my customers’ age

Question

Can my online form calculate my customers’ age?


Answer

Yes, PlatoForms enables you to calculate a customer’s age based on their input. All you need to do is utilize the Text Input field and conditional logic.


Here’s how you can do it:

  1. Add two Text Input fields, setting them both as “Date” type:

    add text input fields

    • One for the customer’s birthday, named “Birthday”.

    • Another for today’s date, named “Today”. Make sure to hide this field so customers don’t see it.

      add birthday date and today’s date

  2. For the field “Today”, set its “Initial Value” to Today's Date.

    set “Initial Value” to `Today’s Date

  3. Add a text input field named “Result”. Make sure to hide this field so customers don’t see it.

    text input for result

  4. Add a text input field named “Age”, and open its properties panel.

    text input for age

    • Set it as “Number” type.

    • Check Currency.

    • Click Decimal places and select ROUND from the dropdown.

    This way, the calculated age can be rounded to a whole number.

  5. Set up conditional logic, as shown below:

    set “Initial Value” to `Today’s Date

    • If the customer’s birthday (#birthday) is answered, the form will automatically calculate their age.

    • The form calculates the difference in days between today’s date and the birthday entered by the customer (Today - Birthday = Result).

    • Then, it converts this difference (Result) to completed years with the calculation Result / 365.25 - 0.5. In the calculator, enter the field Result, then ÷, the value 365.25, then -, the value 0.5.

    • Finally, it displays this age in the “Age” field on the form.

    Why 365.25 - 0.5? Dividing by 365.25 accounts for leap years. Subtracting 0.5 before the ROUND makes the result round down to the customer’s completed years. Without it, anyone more than six months past their last birthday would be shown one year too old.

Result

Let’s say today’s date is April 14, 2024, and a customer enters their birthday as January 1, 1990, into the form.

check final age result

  1. The form calculates the difference between today’s date (April 14, 2024) and the customer’s birthday (January 1, 1990):

    • Days between January 1, 1990, and April 14, 2024 = 12,522 days
  2. Then, it converts this difference to completed years:

    • Result = 12,522 days
    • 12,522 / 365.25 = 34.28
    • 34.28 - 0.5 = 33.78, which ROUND turns into 34

So, the form would display the customer’s age as 34 in the “Age” field. On December 31, 2024, the day before their next birthday, the customer would still be shown as 34; from January 1, 2025 they would be shown as 35.