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.

Dates in calculations

Featured Replies

  • Newbies

I have this calc that gives the age of someone as of today:

NumToText(Year(Today) - Year(Student Date of Birth) - If(Today<

Date(Month(Student Date of Birth), Day(Student Date of Birth), Year(Today)),

1, 0)) & " Years, " & NumToText(Mod(Month(Today) - Month(Student Date of

Birth) + 12 - If(Day(Today) < Day(Student Date of Birth), 1, 0), 12)) & "

Months, " & NumToText(Day(Today) - Day(Student Date of Birth) +

If(Day(Today) >= Day(Student Date of Birth), 0, If(Day(Today-Day(Today)) <

Day(Student Date of Birth), Day(Student Date of Birth), Day(Today-

Day(Today))))) & " Days"

I changed it to give the person's age as of 8/15/2003:

NumToText(Year(Date( 8, 15, 2003 )) - Year(Student Date of Birth) - If(Date( 8, 15, 2003 )<

Date(Month(Student Date of Birth), Day(Student Date of Birth), Year(Date( 8, 15, 2003 ))),

1, 0)) & " Years, " & NumToText(Mod(Month(Date( 8, 15, 2003 )) - Month(Student Date of

Birth) + 12 - If(Day(Date( 8, 15, 2003 )) < Day(Student Date of Birth), 1, 0), 12)) & "

Months, " & NumToText(Day(Date( 8, 15, 2003 )) - Day(Student Date of Birth) +

If(Day(Date( 8, 15, 2003 )) >= Day(Student Date of Birth), 0, If(Day(Date( 8, 15, 2003 )-Day(Date( 8, 15, 2003 ))) <

Day(Student Date of Birth), Day(Student Date of Birth), Day(Date( 8, 15, 2003 )-

Day(Date( 8, 15, 2003 )))))) & " Days"

Now, I'm getting the error: Too many separators.

Am I correct in replacing the "Today" keyword with Date(8,15,2003) to get the result I'm looking for? Why too many separators? Any hints appreciated! I'm a beginner!

Thanks!

Yes you can replace Today with Date(8, 15, 2003), but somewhere along the line you must have made a typo. Too many separators means an extra comma, or a misplaced closing parenthesis.

I received no errors pasting your calc into a field definition. However, I would change Year(Date( 8, 15, 2003 )) to 2003, Month(Date( 8, 15, 2003 )) to 8, and Day(Date( 8, 15, 2003 )) to 15. Also, you can shrink your If(Date( 8, 15, 2003 ) < Date(Month(Student Date of Birth), Day(Student Date of Birth), Year(Date( 8, 15, 2003 ))), 1, 0) to Date( 8, 15, 2003 ) < Date(Month(Student Date of Birth), Day(Student Date of Birth), 2003 ), and similarly with your other boolean If statements.

  • Author
  • Newbies

Thanks everybody...I realized my error was being reported in the middle of the calc...I had pasted the calculation from notepad into fm and somehow a line break got stuck in the middle! tongue.gif

Replace the TODAY function with Status (CurrentDate). The TODAY function only recalculates when the database is opened, so if it's hosted it'll never recalculate.

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.