谢谢 !

解决方案 »

  1.   

    D6:
    DaysBetween(const ANow, AThen: TDateTime): Integer;
      

  2.   

    方法一: 
    VAR Ti,StopT:TTime; 
    begin 
    Ti:=now; 
    edit1.text:=timetostr(Ti); 
    stopT:=Ti - strtodatetime('10:00:00'); 
    edit2.text:=timetostr(stopT); 方法二: 
    procedure TForm1.Button1Click(Sender: TObject); 
    var 
    T: TDateTime; 
    begin 
    T := StrToTime('11:00') - StrToTime('10:00'); 
    ShowMessage(TimeToStr(T)); 
    end; Var S:String; 
    begin 
    S := StrToMyTime( FormatDatetime( 'h:m', 
    StrToTime(11:00)-StrToTime(10:00) ) ); 
    end; Function Tform1.StrToMyTime( s:string ):string; 
    var i,a,b:integer; 
    isB:bool; 
    begin 
    a:=0; 
    b:=0; 
    isB:=False; for i:=1 to length(s) do 
    begin 
    if s[i]=':' then 
    begin 
    isB:=True; 
    continue; 
    end; if not isB then 
    a:=a*10+strtoint(s[i]) 
    else 
    b:=b*10+strtoint(s[i]); 
    end; 
    Result:=inttostr(a)+'小时'+inttostr(b)+'分钟'; 
    end;
      

  3.   

    时间就是Double类型,1等于1天
    怎么不能相减?!
    1也是1899-12-31
      

  4.   

    将dateUtils 加入到单元中
    有很多时期时间的计算函数
      MinutesBetween()
      HoursBetween()
      SecondsBetween()
      MilliSecondsBetween()