Find trending topics and quick answers here
Hi, how can we help?
Search by task, feature, or problem—not just a single keyword.
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:
-
Add two Text Input fields, setting them both as “Date” type:
-
For the field “Today”, set its “Initial Value” to
Today's Date. -
Add a text input field named “Result”. Make sure to hide this field so customers don’t see it.
-
Add a text input field named “Age”, and open its properties panel.
-
Set it as “Number” type.
-
Check Currency.
-
Click Decimal places and select
ROUNDfrom the dropdown.
This way, the calculated age can be rounded to a whole number.
-
-
Set up conditional logic, as shown below:
-
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 value365.25, then-, the value0.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.
-
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
-
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.