Function to calculate how many milliseconds between two specified dates.

 

Syntax

function MilliSecondsBetween(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

Number of milliseconds between two specified dates.

 

Example


var
  dtFrom, dtNow: double;
begin
  dtFrom := Now;
  dtNow  := IncMinute(Now, 10);
  // 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('Milliseconds between 2 dates: ' + IntToStr(MilliSecondsBetween(dtFrom, dtNow)), '');
end.


Script work result

[18:44:12] (Log "MilliSecondsBetween"): From date: 07.04.2016 18:44:12

[18:44:12] (Log "MilliSecondsBetween"): To date: 07.04.2016 18:54:12

[18:44:12] (Log "MilliSecondsBetween"): Milliseconds between 2 dates: 600000

 

See also
IncMinute
IntToStr
mLogScript

Now