Skip to content

IncWeek ​

IncWeek returns the given date, incremented by the number of weeks given as the ANumberOfWeeks parameter.

ANumberOfWeeks can be negative, to return a date, earlier by the specified number of weeks.

The time of day specified by AValue, is copied to the result.

Declaration: Function IncWeek(const AValue: TDateTime; const ANumberOfWeeks: Integer): TDateTime;

This is a simple example.

pascal
procedure OnMapEvent(var Value:Variant);
var
  TheDate, ThatDate, BackDate : TDateTime;
begin
 //Returns a date incremented by 10 weeks
  TheDate := Now;
  ThatDate := IncWeek(TheDate, 10);
  BackDate := IncWeek(TheDate,-10);
  LogInfo(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', TheDate));
  LogInfo(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', ThatDate));
  LogInfo(FormatDateTime('yyyy-mm-dd hh:nn:ss.zzz', BackDate));
end;