Brian Dunning's FileMaker Custom Functions

LastMonth_withYear ( Date2Process )

Calculate the last month and also include the year

  Average rating: 4.3 (4 votes) Log in to vote

João Coutinho   João Coutinho - Show more from this author
http://www.joaocoutinho.net

Share on Facebook Share on Twitter

  Sample input:
01/01/2018
01/02/2018
  Sample output:
12/2017
01/2018

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

When you need to calculate the last month to make searches on the Database, it's difficult to have a good result when you are in January. This function resolves this problem calculating the last month and also including the correct year.

 

Comments

19752   19752, fmc
Jan 11, 2018
You can get the last day of the last month as date-Day(date), then this can be

Let (
d = Date2Process - Day ( Date2Process ) ;
SerialIncrement ( "00/" ; Month ( d ) ) & Year ( d )
)
 
João Coutinho   João Coutinho
Jan 12, 2018
Thanks for the suggestion.
But I used this custom function for searches, so I really don't need the day.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. 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 20 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: