addmonths
addmonths |
Purpose
Add a number of months to a date or datetime.
Synopsis
function addmonths(d:date, nbm:integer):date
function addmonths(dt:datetime, nbm:integer):datetime
Arguments
d
|
A
date object
|
dt
|
A
datetime object
|
nbm
|
The number of months to be added (can be negative)
|
Return value
The modified date or datetime.
Example
writeln(addmonths(date(2000,1,31),1)) ! displays: 2000-02-29 writeln(addmonths(date(2012,12,12),-12)) ! displays: 2011-12-12
Further information
The day number is preserved unless it is not compatible with the computed month: in this case the day number is moved to the last day of the month.
Module