function Minutes(Time: TDateTime): integer;
var
H, M, S, MS: word;
begin
DecodeTime(Time, H, M, S, MS);
result := H * 60 + M;
end;
function MinuteDiff(Beginning: TDateTime; Ending:TDateTime): integer;
begin
Result := Minutes(Ending - Beginning);
end;
function MinutesBetween(const ANow, AThen: TDateTime): Int64;
Description
Call MinutesBetween to obtain the difference, in minutes, between two TDateTime values. MinutesBetween counts only entire minutes that have elapsed. Thus, MinutesBetween reports the difference between 9:00:00 AM and 9:00:59:999 AM as 0 because the difference is one millisecond short of an entire minute.