Delphi中是否有计算时间间隔的函数,类似VB中的DateDiff?

解决方案 »

  1.   

    Daysbetween和dayspan
    前者返回整数,后者返回小数,精度高
    根据你的需要选择吧
      

  2.   

    daysbetween;
    我也记不清了!!手头没有delphi你试一试吧!查一下帮助
      

  3.   

    DaysBetween function
    Returns the number of whole days between two specified TDateTime values.UnitDateUtilsCategorydatetime routinesDelphi syntax:function DaysBetween(const ANow, AThen: TDateTime): Integer;C++ syntax:extern PACKAGE int __fastcall DaysBetween(const System::TDateTime ANow, const System::TDateTime AThen);DescriptionCall DaysBetween to obtain the difference, in days, between two TDateTime values.DaysBetween counts only whole days. Thus, DaysBetween reports the difference between Dec 31, 1999 11:59 PM and Jan 1, 2000 11:58 PM as 0 because the difference is one minute short of an entire day.
      

  4.   

    DaySpan functionReturns the number of days (including fractional days) between two specified TDateTime values.UnitDateUtilsCategorydatetime routinesDelphi syntax:function DaySpan(const ANow, AThen: TDateTime): Double;C++ syntax:extern PACKAGE double __fastcall DaySpan(const System::TDateTime ANow, const System::TDateTime AThen);DescriptionCall DaySpan to obtain the difference, in days, between two TDateTime values. Unlike the DaysBetween function, which only counts whole days, DaySpan reports incomplete days as a fraction of an entire day.