rlbryant Posted December 21, 2004 Posted December 21, 2004 Hello, I searched the forum but cannot find any notes on how to calculate a person's age based on his/her birthdate. I also cannot find this in any of the documentation I have which is surprising as I thought this particular calculation would be very commonly used. How would I do this? Thanks! rlbryant
Lee Smith Posted December 21, 2004 Posted December 21, 2004 What previous post? It is helpful to Post the URL to whatever post you are referring to. Lee
-Queue- Posted December 21, 2004 Posted December 21, 2004 Year(Get(CurrentDate)) - Year(DOB) - (Get(CurrentDate)< Date(Month(DOB); Day(DOB); Year(Get(CurrentDate))))
transpower Posted December 22, 2004 Posted December 22, 2004 http://www.fmforums.com/threads/showflat.php?Cat=&Board=custom&Number=137033
RalphL Posted December 22, 2004 Posted December 22, 2004 Stick with Queue's calculation, tranpower's has flaws. As almost all attemps at this calculation have.
dwins Posted December 22, 2004 Posted December 22, 2004 Truncate((Get(CurrentDate)-birthdate)/365.25;0)
-Queue- Posted December 22, 2004 Posted December 22, 2004 That one doesn't work if you were born between the first and twenty-eighth of February during a non-leap year and today is your birthday.
transpower Posted December 24, 2004 Posted December 24, 2004 Ralph: Please provide one or more counterexamples to the function I gave, if you can, so we can all learn.
rlbryant Posted December 29, 2004 Author Posted December 29, 2004 Thank you very much to everyone who responded. I have this working now in a test system. rlbryant
Joseph31 Posted January 4, 2005 Posted January 4, 2005 I have this equation and it does work, when you are typing in for the frist time... But I have noticed that the age does not change when a birthday passes. Have I done something wrong? Joseph
Lee Smith Posted January 4, 2005 Posted January 4, 2005 The calculation needs to be "Unstored". That is an option provide in the Calculation Window (at least it was in v6 and before). Lee
Joseph31 Posted January 5, 2005 Posted January 5, 2005 Ok, I went into the calc, under storage options and marked do not store anything... But the age did not change? How do I go back through the data base and refresh all for the age? Thank you for the help, Joseph
Himitsu Posted January 5, 2005 Posted January 5, 2005 Joseph, is your field a date field, number field or calculation? I think you have it set to either a date type field or a number, then you are putting that calculation in the "auto-enter" area. Change the field type to a calculation.
Joseph31 Posted January 5, 2005 Posted January 5, 2005 Thank you for the response... My Field is a calc... Thank you Joseph
Lee Smith Posted January 5, 2005 Posted January 5, 2005 At the bottom there is a menu that defaults to number. Change it to Date and see that does it for you.
Joseph31 Posted January 5, 2005 Posted January 5, 2005 The answer is a truncated 2 digit age -- like 71... it is generated by this equation: Case(IsEmpty(Ins_DOB);"";Truncate((Current_Date-Ins_DOB)/365.25;0)) Any idea's? Joseph
-Queue- Posted January 10, 2005 Posted January 10, 2005 Use the calc I posted already. It is more accurate and no truncating is necessary.
Joseph31 Posted January 10, 2005 Posted January 10, 2005 Ok, so I now am using your equation Queue: Year(Get(CurrentDate)) - Year(DOB) - (Get(CurrentDate)< Date(Month(DOB); Day(DOB); Year(Get(CurrentDate)))) On my form this is a calc and a number... Does this mean that the age will increase when his birthday passes? Thank you for the help Joseph
Newbies Muz Posted January 13, 2005 Newbies Posted January 13, 2005 How do I calculate Age from a Date of Birth field and a Date of Death field - ie not using current date
comment Posted January 13, 2005 Posted January 13, 2005 Use Date of Death instead of Get(CurrentDate). I believe this calculation can be stored.
Newbies guayo02 Posted January 14, 2005 Newbies Posted January 14, 2005 Hi, I am trying to work with the code that is being given here and I haven't had success in making it work. I have a field that calculates the equation that was given by the user Queue but I cannot modify the field when I create a record so I do not know how I am suppose to pass a date in order for the calculation to render the number for age. The field which type is Calculation has the equation: Year(Get(CurrentDate)) - Year(DOB) - (Get(CurrentDate)< Date(Month(DOB); Day(DOB); Year(Get(CurrentDate)))) Calculation result is number The above is not working. I've also tried to make the field type number, with the Auto Enter Calculate checked which to I then place the equation which allows me to modify the field, but then the calculation is wrong. Any ideas?
-Queue- Posted January 14, 2005 Posted January 14, 2005 DOB is the Date of Birth field. Once you fill that in, there is no need to pass a date since it naturally passes itself. Calculation fields are not intended to be modified, nor is there any reason to do so in this case. Make sure the calculation is unstored in Storage Options (select 'Do not store calculation results') or the field will not update when the date on your system changes.
raycock Posted January 15, 2005 Posted January 15, 2005 What is the formula for calculation of age in months instead of years?
Recommended Posts
This topic is 7321 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