Papabjoe Posted October 16, 2005 Posted October 16, 2005 Does anyone have a good calcualtion or solution for determining a persons age by comparing currentDate with a field containing the persons date of birth. Seems like a simple solution that I can't seem to make work.
LaRetta Posted October 16, 2005 Posted October 16, 2005 How do you want the age displayed, Papabjoe? Year number only, year number with "years old", Year and Days? How will it need to be formatted?
Kip Posted October 17, 2005 Posted October 17, 2005 You could create a calculation field with a calculation like this: Year(Get(CurrentDate)) - Year(dateofbirth) - (Get(CurrentDate) < Date(Month(dateofbirth); Day(dateofbirth); Year(Get(CurrentDate)))) I found the above calc a long time ago somewhere on this forum. Since then it has worked fine for me.
Kip Posted October 19, 2005 Posted October 19, 2005 I think this one should work better: Case(Day(Get(CurrentDate)) =Day(dateofbirth) and Month(Get(CurrentDate)) ≥ Month(dateofbirth);Year(Get(CurrentDate)) - Year(dateofbirth);Year(Get(CurrentDate)) - Year(dateofbirth) - (Get(CurrentDate) < Date(Month(dateofbirth); Day(dateofbirth); Year(Get(CurrentDate)))))
-Queue- Posted October 19, 2005 Posted October 19, 2005 Both produce the same results. It just depends how convoluted of a calculation you want to use. Note that the second half of your calculation is all that is necessary since (Get(CurrentDate) < Date( Month(dob); Day(dob); Year(Get(CurrentDate)) )) will return 0 when the current date is greater than or equal to the birthdate for the current year, so nothing will be subtracted.
Papabjoe Posted October 20, 2005 Author Posted October 20, 2005 These are all great, I've already inserted one and it's working just great. I always seem to get stuck in one particular line of thought until I hit a brick wall. Usually these posts remind me of something I forgot and then suddenly it all becomes clear. Thanks for your help.
Recommended Posts
This topic is 7041 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now