Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Featured Replies

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.

You could always just use: Floor((Get(CurrentDate) - BirthDate) / 365.25)

as a rough approximation.

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

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).

  • Author

thanks every one for the help, much appreciated.

  • 2 weeks later...

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"

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

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

Lee

[color:red]p.s.

Link is broken

Edited by Guest
p.s.

  • Newbies

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.

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.

  • Newbies

Dang! You're dead on. I should play test these things a touch more before I go spouting off. Thanks.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.