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

Comparing Dates in a Script

Featured Replies

Hello,

I want to compare some dates in a script, and then perform an action based on an IF statement. Here's the pseudocode:

IF (date is between date1 and date2)

...perform action...

How would I do that in a Filemaker script?

Regards,

Evan

Is the date which you want to compare a field in your database? If so, sounds like you need global fields for date1 and date2.

A little more info could be helpful for a more precise script example.

-Courtney

Hi,

This depends on whether you are hardcoding the dates into the script or picking the dates up from 2 fields - here are both ways...

I have used an example where it checks a field called TestDate and if it is between 01 Jan 2003 and 31 Dec 2003 it shows a message saying this year, else it shows a message saying Not this Year.

Hardcoding the dates in the script:

If["TestDate >= Date( 01, 01 , 2003 ) and TestDate <= Date( 12, 31 , 2003 )"]

Show Message["This Year"]

Else

Show Message["Not this Year"]

End If

Picking the dates up from 2 fields:

If["TestDate >= Date( Month ( RangeStartField), Day ( RangeStartField) , Year ( RangeStartField)) and TestDate <= Date( Month ( RandEndField), Day ( RangeEndField) , Year ( RangeEndField) )"]

Show Message["This Year"]

Else

Show Message["Not this Year"]

End If

Regards

Eddy

Sorry, yes as Courtney said StartRangeField and EndRangeField should be global fields as date.

Eddy

  • Author

Excellent work gentlemen.

-Evan

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.