Function to add or subtract the number of months to the specified date.

 

Syntax

function IncMonth(dt: double; iMonths: int64): double;

 

Parameters and return values

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.

 

Function result

Returns a date shifted by a specified number of months.

 

Example


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.


Script work result

[15:50:18] (Log "IncMonth"): [now] 02.23.2016

[15:50:18] (Log "IncMonth"): [-3 months] 11.23.2015

 

See also

FormatDateTime
mLogScript

Now