faaslave Posted August 24, 2006 Posted August 24, 2006 I thought I could search for an age calc, but no luck. I tried this, which is close, but /365 isn't going to work out perfect. Floor ( (Get ( CurrentDate ) - (birthdate) )/ 365 ) What is the best way to do an age calc? Thanks Dave
agtjazz Posted August 24, 2006 Posted August 24, 2006 (edited) One way is Year(Get(CurrentDate))-Year (birthday) or search these forums for "birthday" Edited August 24, 2006 by Guest
faaslave Posted August 24, 2006 Author Posted August 24, 2006 Thanks, I searched for an age calc, (nothing) Then I searched for birthday, seems like everyone wanted something a little different than just a birthday. I tried your calc, birthday = 8/25/2000 todays date = 8/24/2006 your calc returned age = 6 I would hope this would return 5. It is very close. I would think that the calc has got to compare the day of the month, with the month and year, to work out perfectly. I am just unsure how to do it. Thanks for taking the time to help me. Dave
faaslave Posted August 24, 2006 Author Posted August 24, 2006 I thought this might work, but I am not writing it correctly Let ( GetAsNumber ( Year ( CurrentDate ) ) - GetAsNumber ( Year ( birthdate ) ) ; year ; GetAsNumber ( Month ( CurrentDate ) ) ; month ; GetAsNumber ( Day ( CurrentDate ) ) ; day ; Case ( GetAsNumber ( Month ( birthdate ) ) > month ; year - 1 ; GetAsNumber ( Month ( birthdate ) ) < month ; year ; GetAsNumber ( Day ( birthdate ) ) > day ; year - 1 ; year ) ) I think you can see what I was going for. Dave
LaRetta Posted August 24, 2006 Posted August 24, 2006 Dave, what is the format you want as the result? Number only of the year? A text display of 2 years 5 months 2 weeks 3 days? What do you want here? And what are the two dates which will determine your results? Is a the current date against another date or two date fields?
LaRetta Posted August 24, 2006 Posted August 24, 2006 If you want simple number of years, use calculation ( unstored, number) with: Let ( [ now = Get ( CurrentDate ) ; DOBnow = Date ( Month ( birthdate ) ; Day ( birthdate ) ; Year ( now ) ) ] ; Year (now ) - Year ( birthdate ) - ( now < DOBnow ) ) L
faaslave Posted August 25, 2006 Author Posted August 25, 2006 Thanks, that is perfect. I take it that ( now < DOBnow )will return 0 if true and 1 if false? Thank you very much, Dave
LaRetta Posted August 25, 2006 Posted August 25, 2006 "...will return 0 if true and 1 if false?" Actually the other way around. This is a boolean test which produces 1 for true and 0 for false. So if the current date is less than the birthday this year (meaning the birthday hasn't been reached yet) then the result is true and subtracts 1 (year).
Recommended Posts
This topic is 6667 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