Skip to content

IncSecond ​

IncSecond returns the given date, incremented by the number of seconds given as the ANumberOfSeconds parameter.

ANumberOfSeconds can be negative, to return a date, earlier by the specified number of seconds.

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

Declaration: Function IncSecond(const AValue: TDateTime; const ANumberOfSeconds: Int64): TDateTime;

This is a simple example.

pascal
procedure OnMapEvent(var Value:Variant);
var
  TheDate, ThatDate, BackDate : TDateTime;
begin
 //Returns a date incremented by 10 seconds
  TheDate := Now;
  ThatDate := IncSecond(TheDate, 10);
  BackDate := IncSecond(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;