Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6678 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

can some body give me a formula for calculating the age of a person. Will be entering their birth date in a field and then in a seperate feild want their age to appear, thanks.

Posted (edited)

This question has been asked many times in the past. Do a search for [color:blue]+Birthday +Calculation (use the pluses with the words as shown), and you should get many hits, including a few Custom Functions if you had access to Developer / Advance.

Genx has suggested a calculation that will give you the age as in years (i.e. 30), but there are calculations that will give you 30 years, 5 months, 22 days, or Birthdays coming, or Birthdays this week, etc.,. Once you know what you want to show, then you can pick the one you want to adapt to your situation.

HTH

Lee

Edited by Guest
Posted

It's so easy to repost the formula. Here it is:

GetAsNumber(Year(Get(CurrentDate)) -

Year(DOB) - Case(Get(CurrentDate) <

Date(Month(DOB); Day(DOB); Year(Get(CurrentDate))); 1; 0)) & " Years, "

&

GetAsNumber(Mod(Month(Get(CurrentDate)) -

Month(DOB) + 12 - Case(Day(Get(CurrentDate)) <

Day(DOB); 1; 0); 12)) & " Months, "

&

GetAsNumber(Day(Get(CurrentDate)) -

Day(DOB) + Case(Day(Get(CurrentDate)) >=

Day(DOB); 0; Day(Get(CurrentDate) -

Day(Get(CurrentDate))) <

Day(DOB); Day(DOB); Day(Get(CurrentDate) -

Day(Get(CurrentDate))))) & " Days"

If you don't want years, months and days, you can easily remove the portion you don't want as they are separated by concatenation sumbols (ampersand).

  • 2 weeks later...
Posted

Thank you for not making us search to find this. You're amazingly helpful.

I have a question regarding the formula to show age in years, months, and days, which is exactly what I'm trying to get.

When I pop the calculation into my calculation window, what parts of the formula are actually supposed to refer to my field names, and do I need separate fields for day, month and year? And what about CurrentDate - is that just something Filemaker knows what to do with?

This is your formula which I'm referring to:

GetAsNumber(Day(Get(Curre ntDate)) -

Day(DOB) + Case(Day(Get(CurrentDate) ) >=

Day(DOB); 0; Day(Get(CurrentDate) -

Day(Get(CurrentDate))) <

Day(DOB); Day(DOB); Day(Get(CurrentDate) -

Day(Get(CurrentDate))))) & " Days"

Posted

DOB is the Date Of Birth field

Get(CurrentDate) is a FileMaker function that returns the ToDay date; here is important to say that that calculation must be UNSTORED

Posted (edited)

Please review the article "[color:blue]Posting Guidelines" .

Lee

[color:red]p.s.

Link is broken

Edited by Guest
p.s.
  • Newbies
Posted

If(Month(Date 2) ≥ Month(DOB) and Day(Date 2) ≥ Day(DOB),

Year(Date 2 - Year(DOB),

Year(Date 2) - Year(DOB)-1)

This one works if you just want the person's age at a particular time.

Posted

I am afraid this one doesn't work at all: to begin with, you have missed a parenthesis after Date 2 in the second line.

More seriously, take a person born on Jan 15, 2000. According to your calculation, he turns 6 on Jan 15, 2006. Then he keeps that age for the rest of January 2006 - but come February 1, 2006 and suddenly he's back to being 5 years old.

This topic is 6678 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.