How can I calculate age from a date field and store it automatically in a text field?
Confluence User - 08 Oct, 2023
Hello Everyone.
On my form I have a date picker to store date of birth, it's called date_of_birth.
I have a text field for age, it's called age.
How can I use the value of date_of_birth (e.g. 08/10/13) to automatically calculate the age (compare difference between date_of_birth and today's date) and the end result would be to automatically put the age in the Age text field (in this case it would be 10)?
I assume it's done using Beanshell, but I am not sure what the code would be or which field of the two to add it to.
Any help is much appreciated - thanks!
forms;beanshell;datetime