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.

Calculating birth age

Featured Replies

I have a date field that contains the birth date for students. I want to create a field that will calculate the birth age for these students. Does anyone know of a calculation that would let me do this? I guess I also need to account for leap years.

Thanks!

where dob is date of birth:

Truncate((Today-dob)/364.25,0)

Avoid using the Today function, it only recalculates itself at program launch, which means the database has to be closed and reopened every 24 hours for it to be accurate. Use Status[CurrentDate] and Status[CurrentTime] instead, as Chuck suggested.

quote:

Originally posted by dspires:

where dob is date of birth:

Truncate((Today-dob)/364.25,0)

364.25 won't work exactly. The length of an astronomical year (the time for the earth to complete an orbit around the sun) is 365.242 days. Using such a calculation with that number might work. I'm afraid that I would have to think more on it to know.

Chuck

[This message has been edited by Chuck (edited November 08, 2000).]

I agree with avoiding the Today function in situations where the computer is constantly running, but I doubt that being off a day in 125 years matters for a typical student.

Even so, the calculation would be:

Truncate((Status(CurrentDate)- dob)/365.242,0)

[This message has been edited by dspires (edited November 08, 2000).]

[This message has been edited by dspires (edited November 08, 2000).]

Do you just want the whole number of years? If so, try this:

Year( Status( CurrentDate ) ) - Year( Birth_Date ) - ( Status( CurrentDate ) < Date( Month( Birth_Date ), Day( Birth_Date ), Year( Status( CurrentDate ) ) ) )

This first calculates the age given the current year minus the year of the Birth_Date. If the birthday has occurred in the current year already, we are fine. If not, subtract 1.

Chuck

  • 1 month later...

I work for a college in Manchester UK and we have a field that calculates the age down to the number of days.

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

I hope this makes sense and helps.

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.