Brian Dunning's FileMaker Custom Functions

_AddMonths ( vDate ; vAddMonths )

Add x number of months to a given date

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

Makah Encarnacao   Makah Encarnacao
Soliant Consulting
http://www.soliantconsulting.com/

Share on Facebook Share on Twitter

  Sample input:
_AddMonths ( "9/15/2017" ; 9 )
  Sample output:
6/15/2018

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

This function will add months to a given date, for example 5/15/2014 + 3 months = 8/15/2014. It adds to the month value, and does not modify the day value (although FileMaker may automatically modify the day value if the resulting date is not valid). If you would like to subtract months instead of add months, you can tweak the custom function or see my function _SubtractMonths or enter a negative value for the 2nd parameter.

 

Comments

Tim Anderson   Tim Anderson, Tim Anderson Group
Sep 2, 2015
Can be more simple! FileMaker automatically converts a month number greater than 12 to years

Let(
[
vMonth = Month( vDate);
vDay = Day( vDate);
vYear = Year( vDate)
];


Date( vMonth + vAddMonths; vDay; vYear)
)
 

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: