hartmut Posted April 11, 2006 Posted April 11, 2006 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
Lee Smith Posted April 11, 2006 Posted April 11, 2006 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
Kent Searight Posted April 11, 2006 Posted April 11, 2006 Try: GetAsNumber ( Get ( CurrentDate )) - GetAsNumber ( DateOfBirth )
aaa Posted April 11, 2006 Posted April 11, 2006 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.
LaRetta Posted April 11, 2006 Posted April 11, 2006 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.
Recommended Posts
This topic is 6864 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