Returns the number of minutes between two specified TDateTime values.UnitDateUtilsCategorydatetime routinesDelphi syntax:function MinutesBetween(const ANow, AThen: TDateTime): Int64;C++ syntax:extern PACKAGE __int64 __fastcall MinutesBetween(const System::TDateTime ANow, const System::TDateTime AThen);DescriptionCall MinutesBetween to obtain the difference, in minutes, between two TDateTime values. MinutesBetween counts only entire minutes. 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.
var a, b, c: TTime;begin a := StrToTime('20:05:30'); b := StrToTime('13:07:50'); c := a - b; showmessage(TimeToStr(c)); end; 不过你肯定还要把日期也计算上的
procedure TForm1.Button1Click(Sender: TObject); var t1,t2:TDateTime; time:integer; begin t1:=strtodatetime('2005-7-14 20:05:30'); t2:=now; time:=round((t2-t1)*24*60); ShowMessage('用了'+inttostr(time)+'分钟'); end;
a, b, c: TTime;begin
a := StrToTime('20:05:30');
b := StrToTime('13:07:50');
c := a - b;
showmessage(TimeToStr(c));
end;
不过你肯定还要把日期也计算上的
var t1,t2:TDateTime;
time:integer;
begin
t1:=strtodatetime('2005-7-14 20:05:30');
t2:=now;
time:=round((t2-t1)*24*60);
ShowMessage('用了'+inttostr(time)+'分钟');
end;