Discussion
3
Replies
1927
Views
Accenture
Posted: April 18, 2016
Last activity: February 2, 2017
Closed
Declare expression for Age
Im looking for a declare expression which calculates the Age based on the Date of Birth.
Could someone please help me with this?
When do you want the expression to fire? You would need to use "Whenever Used" and current date time to be accurate at all times but that may lead to inconsistencies. Perhaps the age should be based on a fixed date such a person's age on the date that a claim was filed? If the second date is fixed then you can use "Whenever inputs change".
The logic for computing human age is not solved by rounding down i.e., using floor(), after dividing by the number of days in a year since every 4th year has 366 days not 365. Instead the logic for computing human age is as follows:
The logic above assumes Year2 >= Year1. You can use Functions in the DateTime Library for year() and dayofyear().