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

 

Syntax

function IncDay(dt: double; iDays: int64): double;

 

Parameters and return values

Parameter

Type

Value

dt

double

date value to which you need to add or subtract days;

iDays

int64

number of days that need to be added or subtracted. If the number is positive then days are added, if negative — subtracted.

 

Function result

Date shifted by a specified number of days.

 

Example


var
  dt: double;
begin
  dt := Now;
  
  mLogScript(FormatDateTime('mm.dd.yyyy', dt), 'current date');
  
  dt := IncDay(dt, -100);
  mLogScript(FormatDateTime('mm.dd.yyyy', dt), '-100 days');
  
  dt := IncDay(dt, 100);
  mLogScript(FormatDateTime('mm.dd.yyyy', dt), '+100 days');
end.


Script work result

[15:08:15] (Log "IncDay"): [current date] 02.23.2016

[15:08:15] (Log "IncDay"): [-100 days] 11.15.2015

[15:08:15] (Log "IncDay"): [+100 days] 02.23.2016

 

See also

FormatDateTime
mLogScript

Now