Function to add or subtract the number of hours to the specified date.

 

Syntax

function IncHour(dt: double; iHours: int64): double;

 

Parameters and return values

Parameter

Type

Value

dt

double

date value to which you need to add or subtract hours;

iHours

int64

number of hours that you need to add or subtract. If the number is positive — add hours, if negative — subtract.

 

Function result

Returns a date/time value shifted by a specified number of hours.

 

Example


var
  dt: double;
begin
  dt := Now;
  
  mLogScript(FormatDateTime('mm.dd.yyyy hh:nn:ss', dt), 'now');
  
  dt := IncHour(dt, 10);
  mLogScript(FormatDateTime('mm.dd.yyyy hh:nn:ss', dt), '+10 hours');
end.


Script work result

[15:24:21] (Log "IncHour"): [now] 02.23.2016 15:24:21

[15:24:21] (Log "IncHour"): [+10 hours] 02.24.2016 01:24:21

 

See also

FormatDateTime
mLogScript

Now