请问如何求二个时间差

解决方案 »

  1.   

    strtodate(edit2.text)-strtodate(edit1.text)
      

  2.   

    1. 得到天数之差: DaysBetween(date1, date2)
    2. 得到秒数之差: GetTickCount;
      

  3.   

    1. 得到天数之差: DaysBetween(date1, date2)
    2. 得到秒数之差: GetTickCount同意:simonvc(约书亚)
      

  4.   

    用  DecodeDate 函数delphi中
    procedure TForm1.Button1Click(Sender: TObject);var
      Present: TDateTime;
      Year, Month, Day, Hour, Min, Sec, MSec: Word;
     begin
      Present:= Now;
      DecodeDate(Present, Year, Month, Day);
      Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
        + IntToStr(Month) + ' of Year ' + IntToStr(Year);
      DecodeTime(Present, Hour, Min, Sec, MSec);
      Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
        + IntToStr(Hour);
    end;
      

  5.   

    GetTickCount
    i1,i2
    i1=gettickcount;
    ....
    i2=gettickcout;
    i2-i1就可以了
      

  6.   

    datediff(minute,开始时间,结束时间)在SQL中
      

  7.   

    可以用FormatDateTime格式化时间
    再相减嘛