STD.Date.AdjustCalendar( date , [year_delta],[month_delta] ,[day_delta] )
date | A date value in the Date_t format. |
year_delta | The minimum acceptable year. Optional; defaults to zero. |
month_delta | The minimum acceptable year. Optional; defaults to zero. |
day_delta | The maximum acceptable year. Optional; defaults to zero. |
Return: | AdjustDate returns date_t representing the adjusted date. |
The AdjustCalendar function adjusts a date by incrementing or decrementing months and/or years. The date must be in the Gregorian calendar after the year 1600.
This uses the rule outlined in McGinn v. State, 46 Neb. 427, 65 N.W. 46 (1895):
"The term calendar month, whether employed in statutes or contracts, and not appearing to have been used in a different sense, denotes a period terminating with the day of the succeeding month numerically corresponding to the day of its beginning, less one. If there be no corresponding day of the succeeding month, it terminates with the last day thereof."
Note that day adjustments are performed after year and month adjustments using the preceding rules.
As an example, Jan. 31, 2014 + 1 month results in Feb. 28, 2014; Jan. 31, 2014 + 1 month + 1 day results in Mar. 1, 2014.
Example:
IMPORT std; inDate :=19631123; Std.Date.AdjustCalendar(inDate,5,1,3); //returns 19681226
See Also: AdjustDate