我要把两个时间相减,并将结果转换为int 类型引用
请问我该怎么做?

解决方案 »

  1.   

    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.
      

  2.   

    DaysBetween(today,Yesterday)
    这个函数会返回1,得到的是今天和昨天的相差天数阿!!
      

  3.   

    日期直接减,得到主不应该是INT型呀
      

  4.   

    我就想得到INT类型的
    我该怎么转换啊
      

  5.   

    如果你要小时分钟级的时间差:
    首先,两个DataTime是可以直接运算的,因为定义如下
    type TDateTime = type Double;
    所以做差即可:ADataTime := DataTimeA-DataTimeB
    然后用这个转换即可:
    StrToInt(FormatDateTime('hhmmss', ADataTime)).
      

  6.   

    ADataTime 是什么类型呢
    怎么定义的
      

  7.   

    都是TDataTime类型的,你要算哪个级别的时间差?年?月?日?时?分?秒?
    多说一些细节