Find trending topics and quick answers here
Hi, how can we help?
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:
-
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.
-
-
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
ROUND
from 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 (Birthday - Today = Result).
-
Then, it divides this difference (Result) by 365 (the approximate number of days in a year) to get the customer’s age.
-
Finally, it displays this age in the “Age” field on the form.
-
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 April 14, 2024, and January 1, 1990 = 12,175 days
-
Then, it divides this difference by 365 (approximate days in a year) to get the customer’s age:
- Result = 12,175 days
- Age = Result / 365 days per year ≈ 33.32 years (round up to 34)
So, the form would display the customer’s age as 34 in the “Age” field.
Have more questions? Visit our FAQs page or contact us.