Difference date and time (Delphi function)

=== funcion getDateDiff ===

uses System.DateUtils;

type
  TDateTimeDiff = record
    DayDiff: Word;
    TimeDiff: TTime;
  end;

function getDateTimeDiff(Date1, Date2: TDateTime): TDateTimeDiff;
begin
  Result.DayDiff := DaysBetween(Date1, Date2);
  Result.TimeDiff:= TTime(Date2) - TTime(Date1);
end;

Comments