Bikeman17 Posted July 23, 2015 Posted July 23, 2015 Hi there, I am trying to subtract two fields to get the age but I got a wrong calculation. I tried to use Getastext but I am missing something. Please help Today : Get(CurrentDate) Birthday : Text Age : Number
Kris M Posted July 23, 2015 Posted July 23, 2015 (edited) date 1 - date 2 returns the difference. http://help.filemaker.com/app/answers/detail/a_id/5544/~/calculating-the-differences-between-dates-in-filemaker-pro If birthday is text is must be converted to date or be a properly formatted date. age = number of what? years? days? months? combination? Edited July 23, 2015 by Kris M
doughemi Posted July 23, 2015 Posted July 23, 2015 (edited) After converting the birthdate to a date, as Kris said, you can use this calc: Let([ g.today = Get(CurrentDate); ElapsedYears=Year(g.today) - Year(birthDate) - If(g.today <Date(Month(birthDate); Day(birthDate); Year(g.today)); 1; 0); ElapsedMonths =Mod(Month(g.today) - Month(birthDate) + 12 - If(Day(g.today) < Day(birthDate); 1; 0); 12); ElapsedDays = Day(g.today) - Day(birthDate) + If(Day(g.today) ≥ Day(birthDate); 0; If(Day(g.today - Day(g.today)) < Day(birthDate); Day(birthDate); Day(g.today - Day(g.today)))) ]; If(birthDate="";""; ElapsedYears & " Year" & If(ElapsedYears = 1; "";"s") & ", " & ElapsedMonths & " Month" & If(ElapsedMonths = 1; ""; "s" ) & ", " & ElapsedDays & " Day" & If(ElapsedDays =1; ""; "s") ) ) Edited July 23, 2015 by doughemi
Recommended Posts
This topic is 3467 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