Brian Dunning's FileMaker Custom Functions

GetPastDate ( dateStart ; monthsNumber )

Find past date 1-12 month/s from a given date - helps construct date ranges

  Average rating: 4.5 (10 votes) Log in to vote

Robert Jackson   Robert Jackson
RJPlus Consulting

Share on Facebook Share on Twitter

  Sample input:
GetPastDate ( Get(CurrentDate , 6 )

// UK date format used here
// assuming today = "25/1/2016
  Sample output:

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This allows you to get a date - say six months ago. The idea is to help with the construction of date ranges.

dateStart & "..." & GetPastDate (would give a six month date range if monthsNumber = 6)



Lee Smith   Lee Smith
Oct 27, 2016
This will break if Leap Year is involved.
Robert Jackson   Robert Jackson, Dundee
Oct 31, 2016
Thanks for looking at this custom function Lee. It seems OK to me - I tested it with leap year options and for other years. Could you give me an example where it breaks - it would be most helpful - ta
Tom Fitch   Tom Fitch
Oct 31, 2016
No need to make it that complicated. FileMaker will happily accept a negative month number (or day, but not year) and return the appropriate date. Works for leap years too. Let FileMaker do the math!
Let( now = Get(CurrentDate) ;
Date ( Month ( now ) - 6 ; Day ( now ); Year ( now ) ) )
Lee Smith   Lee Smith
Oct 31, 2016
It might be confusing because you and i have a different date structure.
i.e. yours is Day/Month/Year and mine is Month/day/year

If you are going from Mar 29 to Feb (one month) you get March 1st.

Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 16 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: