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

 

Syntax

function IncWeek(dt: double; iWeeks: int64): double;

 

Parameters and return values

Parameter

Type

Value

dt

double

date/time value to which you need to add or subtract the number of weeks;

iWeeks

int64

number of weeks which you need to add or subtract. If the number is positive — add weeks, if negative — subtract.

 

Function result

Returns a date shifted by a specified number of weeks.

 

Example


var
  dt: double;
begin
  dt := Now;
  
  mLogScript(FormatDateTime('mm.dd.yyyy hh:nn:ss:zzz', dt), 'now');
  
  dt := IncWeek(dt, 4);
  mLogScript(FormatDateTime('mm.dd.yyyy hh:nn:ss:zzz', dt), '+4 weeks');
end.


Script work result

[15:40:11] (Log "IncWeek"): [now] 02.23.2016 15:40:11:803

[15:40:11] (Log "IncWeek"): [+4 weeks] 03.22.2016 15:40:11:803

 

See also

FormatDateTime
mLogScript

Now