Brian Dunning's FileMaker Custom Functions

endDate ( theDate ; months )

Calc the end date based on number of months to preserve the day of month.

  Average rating: 4.8 (28 votes) Log in to vote

Timothy Brown   Timothy Brown - Show more from this author
Antidote Solutions
http://www.antidotesolutions.com

Share on Facebook Share on Twitter

  Sample input:
endDate( 7/31/2010; 7)
  Sample output:
2/28/2011

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

This solves the problem of alway billing an item on the same day each month. We capture for the days that may be the last day of the month.

If we always bill on the 30th of each month. Then when we get to February, it will calculate the 28th, instead of March 2nd. This calculation is different then the last day of the month, because it allows you to pick the day of the month to always repeat.

 

Comments

Jack Rodgers   Jack Rodgers, FmpApps
May 18, 2011
Try verifying this for 28, 29, 30, 31 for various months, especially February. Also, check for leap years.

For these one must determine what to do such as if the date is the 31 but the last day of the chosen month is 28, 29 or 30.

A typical problem for EOM billing.
 
Tim Brown   Tim Brown, Garden City, NY
May 18, 2011
Thanks for the test. Just updated the calc to consider the last days of the month.
 
Carsten van Dyhr   Carsten van Dyhr, Höör/Sweden
May 29, 2018
Saved me a lot of time, thanks a lot
 

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: