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.

Featured Replies

Hi,

I got a really long age calculation from FileMaker's web site which returns results in a "36Years, 6Months, 14Days" format. This is working ok but isn't the best solution for my data base. I would actually like two results based off of my birthdate field; one that returns just how many years old the person is (with out the months and days), and another that returns an "age nearest birthday" result. For example, if the persons birthdate is 1/1/1980, on July 2nd of 2002 they would be 23, age nearest birthday. But on June 29th 2002 they would still be 22. Does this make sense?

Here is the calculation I got from FileMaker:

NumToText(Year(Today) - Year(Birthdate) - If(Today<Date(Month(Birthdate),Day(Birthdate),Year(Today)), 1, 0))&"Years,"&NumToText(Mod(Month(Today) - Month(Birthdate) + 12 - If(Day(Today) < Day(Birthdate), 1, 0), 12))&"Month,"&NumToText(Day(Today) - Day(Birthdate) + If(Day(Today) >=Day(Birthdate), 0,If(Day(Today- Day(Today)) < Day(Birthdate),Day(Birthdate),Day(Today- Day(Today)))))&"Days"

Any help would be greatly appreciated.

Joe

confused.gif

AOL#Leeftijd Calculation (Text) = Int(((Year(Today)*12+Month(Today)) -(

Year(AOL_DAT_geboorte)*12+Month(AOL_DAT_geboorte)))/12) & " jaar en " &

Mod(((Year(Today)*12+Month(Today)) -(

Year(AOL_DAT_geboorte)*12+Month(AOL_DAT_geboorte)));12)& " mnd"

This one gives you the age in years and months. Use it myself.

geboorte=birthdate

jaar= year

mnd = month(s)

leeftijd = age

(that's a short lesson in dutch..)

harryk

This solution looks funny but it seems to work:

I created 6 new fields you would use at least some of yours:

Birthdate Date Field

NextBirthday Calculation (Number) Unstored calculation

= Case(Month(Status( CurrentDate)) < Month(Birthdate),Year( Status( CurrentDate)) - Year(Birthdate),Year( Status( CurrentDate)) -

Year(Birthdate) + 1)

Years Calculation (Number) = Year(ALL)-1

Months Calculation (Number) = Month(ALL)-1

Days Calculation (Number) = Day(ALL)-1

ALL Calculation (Date) = Status( CurrentDate) - Birthdate

The odd part is formating the ALL calculation as a Date.

You could then combine your calculation to say

Years &"Yrs" & Months& "Months"&Days&"Days"

Note: Use Status(CurrentDate) instead of Today.

  • Author

Hey, thanks for the replies guys. I haven't had a chance to fiddle with them. Do either of your calculations result in the "age nearest birthday" solution I was looking for?

Joe grin.gif

>age nearest birthday?

My solution does not really what you want; it outputs the years and the months for example <22 years 7 mnth>. If you fiddle around a bit with this calculation you might round the result to 23 if mnth>6, else 22. I just give you the start, perhaps you can finish it your way..

In theory, one pretty slick way to do it is like this. I've done similar things, but not exactly the same.

What you wnant to do is convert your date to an integer, so that you can round it. So...

daynumber = (divide the current day by (the date number of the day before the first day of the next month)) + current month

then...

bdaynumber = the same, but with their birthday

then...

next = mod(12, bdaynumber + 12 - daynumber)

last = mod(12, daynumber + 12 - bdaynumber)

if next is a smaller number, the next birthday is closer, if last is smaller, the last birthday is closer

Make sense?

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.