Brian Dunning's FileMaker Custom Functions

AddMonths

Properly adds months to dates

  Be the first to rate this function Log in to vote

Ian Summerfield   Ian Summerfield - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
AddMonths ( "12/30/2018)" ; 14 )
  Sample output:
02/29/202

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

You don't need this function! Please don't tell me you can simply add to the month using the date function! You can't. If you are working with Payrolls or something similar, you need this function.

I wanted to pay someone on the 30th of each month, but there is no 30 in February. Filemaker handles this by simply wrapping over in the next month, resulting in the 2nd March. Any normal company will pay on the last day on the month instead. This function deals with it, it'll return 28th Feb or 29th Feb as needed by simply seeing the day no longer matches after adding the required amounts of months and then reverting to 1st of that month and deducting a day, that gives the last day of the month, Jan 30 + 1 month = Mar 03; make that Mar 01 and deduct a day; result = Feb 28 or 29.

 

Comments

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 15 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:

Under construction. Email me your wish list for improvements.