Function to add or subtract the number of months to the specified date.
function IncMonth(dt: double; iMonths: int64): double;
Parameter |
Type |
Value |
---|---|---|
dt |
double |
date value to which you need to add or subtract months; |
iMonths |
int64 |
number of months which you need to add or subtract. If the number is positive — add months, if negative — subtract. |
Returns a date shifted by a specified number of months.
var
dt: double;
begin
dt := Now;
mLogScript(FormatDateTime('mm.dd.yyyy', dt), 'now');
dt := IncMonth(dt, -3);
mLogScript(FormatDateTime('mm.dd.yyyy', dt), '-3 months');
end.
[15:50:18] (Log "IncMonth"): [now] 02.23.2016
[15:50:18] (Log "IncMonth"): [-3 months] 11.23.2015