How can I add 1-12 months to a date not days. eg. 09/02/1025 + 1 month = 10/02/2015
You can add to the specific month. I think I'd do it this way.
_Start = Date (9;2;2015);
_AddTo = 3 //the number of months to add to
Date ( Month (_Start) + _AddTo ; Day (_Start) ; Year (_Start) )
Here I'm taking the month in the _Start variable and adding to it the number of months in the _AddTo variable. (Of course the addend can be a field).
If you have FileMaker Pro Advanced, you could even create a custom function called: MonthAdd (GivenDate ; MonthsToAdd):
_AddTo = MonthsToAdd
Creating that will allow you to simply call this function and pass in the date you want and the number of months you want to add it to.
Try: Date ( Month ( field ) + 1 ; Day ( field ) ; Year ( field ) )
Where "field" equals your starting point.
Month(Date1) + 1 ;
... but you would need to account for issues that occur when the next month has less days than the previous month... e.g. adding 1 month to Jan 30th will bring up March 1st.
One way of dealing with that would be to use a Let statement to calculate a series of variables (starting with the above calculation) and check if the resulting day number is the same between Date1 and Date2 - if this is not the case, make the day number equal to the 1st of the month in Date2 minus 1.
further to the last example calc, the following would work if you want to show the last day of the month when adding one month to Jan 31 st etc...
$a = Date1 ;
$b = Date ( Month(Date1) + 1 ; Day(Date1) ; Year(Date1) )
If ( Day($a) ≠ Day($b) ; Date ( Month($b) ; 1 ; Year($b) ) - 1 ; $b )
Retrieving data ...