Adds months to a date.
Date = SRP_Date("AddMonths", Date, Months)
Returns
A new date.
Parameters
Parameter | Description |
---|---|
Date | A date in OI internal format. (REQUIRED) |
Months | The number of months to add. (REQUIRED) |
Remarks
The "AddMonths" service calculates a new date by adding the given number of months to an existing date. You can pass whole numbers or decimal numbers. You can also pass negative values to subtract months.
Note that months are an abstract concept, so adding months is also done abstractly. If the current month is February 28, and you add 1 whole month, you will get March 28. In other words, whole months are added without altering the day of the month, unless the day would be invalid. As an example, If you add 1 whole month to January 31, you'll get February 28. Fractions of a month are calculated using the average month length, which is 30.4375. For example, if you add 1.5 months to February 28, you'll get April 12th, which is 15 days (half of 30.4375) after March 28th.
Examples
// Add 10 months to the current date NewDate = SRP_Date("AddMonths", Date(), 10) // Add a month and a half to the current date NewDate = SRP_Date("AddMonths", Date(), 1.5) // Subtract 10 months from the current date NewDate = SRP_Date("AddMonths", Date(), -10)