var tStart,tEnd,m:integer;
tStart:=GetTickCount;
...
tEnd:=GetTickCount;
m:=(tStart-tEnd) div 60;

解决方案 »

  1.   

    错了:
    //秒数
    m:=(tStart-tEnd)/1000;
    //分数。
    m:=m/60;
      

  2.   

    gettickcount是什么函数?我怎么在帮助里查不到!
      

  3.   

    GetTickCount是WinAPI,记录从Windows启动开始后流逝的时间,毫秒单位
      

  4.   

    我是要记录当前系统时间,这是可以人为调整的!就像“2000-12-20 15:30:00”与“2000-12-20 15:16:00”我要的就是这两个之间的时间差!DELPHI中我用函数now得到时间!谢谢两位的帮助,请帮我再想一下! 
      

  5.   

    var Date1,Date2:TDateTime;procedure TForm1.Button1Click(Sender: TObject);
    begin
      date1:=now;
      label1.caption:=datetimetostr(date1);
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      date2:=now;
      label2.caption:=datetimetostr(date2);
      showmessage(timetostr(date1-date2));
    end;
      

  6.   

    saoren首先谢谢你!但可能你还是没明白我的意思!我是想得到date1-date2的差,再将这个差转换成分钟“数”后乘以一个常数!
      

  7.   


    function Tform1.GetMaskString(S,Mask:string;Position:integer):string;
    var Str:string;
        i,Len:integer;
    begin
      Str:='';
      for i:=0 to Position -1 do
      begin
        if (Pos(Mask,S)<=0) then //最后
        begin
          Str:=S;
          Break;
        end;
        Str:=Copy(S,1,Pos(Mask,S)-1);
        Len:=Length(Str);
        S:=Copy(S,Len+2,Length(S)-Len-1);
      end;
      Result:=Str;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      date1:=now;
      label1.caption:=datetimetostr(date1);
    end;procedure TForm1.Button2Click(Sender: TObject);
    var S,sec,min,hour:string;
       h,m,se:integer;
    begin
      date2:=now;
      label2.caption:=datetimetostr(date2);
      S:=timetostr(date1-date2);
      hour:=GetMaskString(S,':',1);
      min:=GetMaskString(S,':',2);
      sec:=GetMaskString(S,':',3);  h:=strtoint(hour)*60;
      se:=strtoint(sec) div 60;
      m:=strtoint(min);
      showmessage('我要的时间差是:'+inttostr(h+m+se)+'分钟');
    end;
      

  8.   

    ? = StrToInt(FormatDateTime('n',Now)) - StrToInt(FormatDatetime('n',oldtime))三少 :o)
      

  9.   

    TDateTime实质上是一种Double型的变量,其整数部分表示天数,小数部分表式时间(例如:pm12:00就是0.5  pm18.00就是0.75,以此类推)所以,要求分钟数就是(date1-date2)*24*60,取整数就是结果!
      

  10.   

    SAOREN谢谢你了!
    我的OICQ是:1766465希望和你成为朋友!呵呵,不过我可是菜鸟呀!
      

  11.   

    提示一下:
    Datetime := Datetime2 - Datetime1;
    year  := Decodedate()
    month :=...
    date  := ...
    hh    := Decodetime()
    mm    := ....
    ss    := ....
    怎么处理,应该知道了吧!
      

  12.   

    jzy的回答应该是最佳答案,我再加10分。
      

  13.   

    CTime time1=CTime::GetCurrentTime();
    //----------do something
    CTime time2=CTime::GetCurrentTime();
    CTimeSpan timeSpan=time2-tim1;
    int nMinutes=timeSpan.GetTotalSecond/60;