Function to calculate how many whole seconds between two specified dates.

 

Syntax

function SecondsBetween(dNow, dThen: double): integer;

 

Parameters and return values

Parameter

Type

Value

dNow

double

first value of the date and time;

dtThen

double

second value of the date and time.

 

Function result

Returns the number of seconds between two dates.

 

Example

var
  dtFrom, dtNow: double;
begin
  dtNow  := Now;
  dtFrom := IncSecond(dtNow, -100);
  // print this dates
  mLogScript('From date: ' + FormatDateTime('mm.dd.yyyy hh:nn:ss', dtFrom), '');
  mLogScript('To date: ' + FormatDateTime('mm.dd.yyyy hh:nn:ss', dtNow), '');
  
  mLogScript('Result: ' + IntToStr(SecondsBetween(dtFrom, dtNow)), '');
end.

Script work result

[18:14:15] (Log "SecondsBetween"): From date: 07.05.2016 18:12:35

[18:14:15] (Log "SecondsBetween"): To date: 07.05.2016 18:14:15

[18:14:15] (Log "SecondsBetween"): Result: 100

 

See also
IncSecond
IntToStr
mLogScript

Now