How to add days and hours to a date-time variable?
delphi
Solution
You can use the `+` operator to add an integral number of days, and use `SysUtils.ReplaceTime()` to change the time, eg:
uses
..., SysUtils;
var
DT: TDateTime;
begin
DT := EncodeDate(2013, 12, 30); // Dec 30 2013 @ 12AM
DT := DT + 10; // Jan 9 2014 @ 12AM
ReplaceTime(DT, EncodeTime(20, 0, 0, 0)); // Jan 9 2014 @ 8PM
end;
Problem
If I need to get a date like `12/30/2013` and add 10 days at 8pm, How can I do that in Delphi if I have a `TDateTime` variable with that first date?