April 11, 200619 yr Hello I have a calculation which determines the age of a person. it is Year(Get(CurrentDate)) - Year(dateofbirth) This however returns 56 years. The original dateofbirth entry was 05/29/1950 I wouldlike to find a way or a formula to determine the exact number of days this person has been alive and I need help with this. Thanks very very much Dave
April 11, 200619 yr This topic comes up all of the time. If you did a search for Age, Birthday Calculation, etc. you should see a bunch of treads on this. Here is a calculation: GetAsNumber(Year(Get(CurrentDate)) - Year(dateofbirth) - Case(Get(CurrentDate) < Date(Month(dateofbirth); Day(dateofbirth); Year(Get(CurrentDate))); 1; 0)) & " Years, " & GetAsNumber(Mod(Month(Get(CurrentDate)) - Month(dateofbirth) + 12 - Case(Day(Get(CurrentDate)) < Day(dateofbirth); 1; 0); 12)) & " Months, " & GetAsNumber(Day(Get(CurrentDate)) - Day(dateofbirth) + Case(Day(Get(CurrentDate)) >= Day(dateofbirth); 0; Day(Get(CurrentDate) - Day(Get(CurrentDate))) < Day(dateofbirth); Day(dateofbirth); Day(Get(CurrentDate) - Day(Get(CurrentDate))))) & " Days" HTH Lee
April 11, 200619 yr Hi, hartmut! Get(CurrentDate)-dateofbirth must be your wish. You tried it? If you want to get how many years and how many days, this can be did by other formula.
April 11, 200619 yr And I'll add to it. The issue is dropping one year if the current year's birthday hasn't happened yet. Since you just want number of years, try: Let ( thisBday = Date ( Month ( dateofbirth ) ; Day ( dateofbirth ) ; Year ( Get (CurrentDate) ) ) ; Year ( Get ( CurrentDate) ) - Year ( dateofbirth ) - ( thisBday > Get ( CurrentDate ) ) ) Corrected less than to greater than ... Freudian slip. And I should mention this is result of number and needs to be UNSTORED. The GetAsNumber is not required because FM adds dates just fine - they ARE numbers. I believe you threw Kent off because you contradicted yourself - first wanting years but then saying exact number of DAYS. If so, a number result with: Get ( CurrentDate ) - dateofbirth will give you their total days.
Create an account or sign in to comment