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

Tim Brown   Tim Brown
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, Hollywood, FL
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.

Under construction. Email me your wish list for improvements.