The formula to calculate age is: (Current date – Date of birth) / 1 year.Triggre does not know ‘year’, so you have to use 365.25 * 1 day. This takes account of leap years.
The result is a number with six decimals. You must reduce that to the integer value: 46.653876 must become 46.
There are two ways to do this:
Triggre will round the outcome up or down, depending on the value. But, when calculating age, you always want to round down. For example, 46.7 should become 46, not 47.
Rounding down a number
To make Triggre round numbers down, you subtract 0.5 from the value before you store it.
Let’s use the age of 46 as an example. The smallest possible result of the function is 46.000000, the largest is 46.999999.
When you subtract 0.5, they will become 45.500000 and 46.499999.
When you store these values or any value in between, Triggre will round them to 46.
Include a decision to validate the date of birth. If it’s empty or > 115 years ago, the output will be a message suggesting a better input.