AddHours(Value: DateTime; Count: Integer): DateTime;
Value - initial date.
Count - the number of added hours.
The AddHours method adds the specified number of hours to the initial date passed as the Value parameter.
Sub Main;
Var
DT, DT1, DT2, DT3, DT4: DateTime;
Begin
DT := DateTime.Parse("01.01.2004 10:20:20");
DT1 := DateTime.AddHours(DT, 1);
DT2 := DateTime.AddHours(DT, -3);
DT3 := DateTime.AddHours(DT, 190);
DT4 := DateTime.AddHours(DT, -590);
End Sub Main;
After executing the example the "DT", "DT1", "DT2" and "DT3" and "DT4" variables will contain the following values:
"DT" - "01.01.2004 10:20:20"
"DT1" - "01.01.2004 11:20:20"
"DT2" - "01.01.2004 7:20:20"
"DT3" - "09.01.2004 8:20:20"
"DT4" - "07.12.2003 20:20:20"
See also: