MinutesApart Function |
Unit
QESBPCSDateTime
Declaration
Function MinutesApart(const DT1, DT2: TDateTime): Word;
Parameters |
DT1 | First Time, Date portion ignores - assumed to be the earlier time. |
DT2 | Second Time, Date portion ignores - assumed to be the later time. |
Category
Date/Time Arithmetic RoutinesImplementation
function MinutesApart (const DT1, DT2: TDateTime): Word; var Hr1, Min1, Sec1, MSec1: Word; Hr2, Min2, Sec2, MSec2: Word; begin ESBDecodeTime (DT1, Hr1, Min1, Sec1, MSec1); ESBDecodeTime (DT2, Hr2, Min2, Sec2, MSec2); if Min2 < Min1 then begin Min2 := Min2 + 60; if Hr2 > 0 then Dec (Hr2) else Hr2 := 23; end; if Hr1 > Hr2 then Hr2 := Hr2 + 24; Result := (Hr2 - Hr1) * 60 + (Min2 - Min1); End; |
|