MyChat Scripts Engine: HoursBetween
Function to calculate how many whole hours between two specified dates.
Syntax
function HoursBetween(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 whole hours between two specified dates.
Example
var
  dtFrom, dtNow: double;
begin
  dtFrom := Now;
  // and +8.5 hours
  dtNow  := IncMinute(Now, 510);
  // 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('Full hours between 2 dates: ' + IntToStr(HoursBetween(dtFrom, dtNow)), '');
end.
Script work result
[10:46:26] (Log "HoursBetween"): From date: 07.04.2016 10:46:26
[10:46:26] (Log "HoursBetween"): To date: 07.04.2016 19:16:26
[10:46:26] (Log "HoursBetween"): Full hours between 2 dates: 8