to movingboy(movingboy):
相减后也是一个日期型。如果两日期相同,则结果是1899-12-31,何解?
你说的整数部分是什么意思?

解决方案 »

  1.   

    datetoint(date1-date2)的整数=天数
      

  2.   

    天数=datetoint(date1)-datetoint(date2)
      

  3.   

    to ghz2000(浩中):
    delphi好像没有datetoint这个函数?
      

  4.   

    天数=datetoint(date1)-datetoint(date2) 
      

  5.   

    你的D5中有datetoint这个函数吗??!!
      

  6.   

    to lzzqqq(Jonersen):
    起码我在HELP中找不到datetoint这个函数,你们从哪里看见的?
      

  7.   

       var x:double;
          y:integer;
       x:=date12-date2;
       y:=trunc(x);
       label1.caption:=inttostr(y);
      

  8.   

    DateTime类型是Double型的
    type  TDateTime = type Double;
    天数 := Trunc( Date1 )-Trunc( Date2 )
      

  9.   

    to chenpppp5678(chen):
    能具体一点吗?最好举一例子!
      

  10.   

    说实话我也没做过,不过我想似乎两个日期相减得到一个具体的时间似乎没有什么意义!
    日期相减得到一个天数,我已给你提供了日期想减得到天数的源程序,日期和实践疏通一类型的变量,你可以去试试!
    再见!
    有没有数据悲愤的源程序,给我?
    我的OICQ:23681668
    [email protected]!
      

  11.   

    你可用一个简单的办法去处理
      调用如下一个函数:DateDiff
      

  12.   

    請這樣處理:
    如:
    Function GetDecDateNum:String;
    var
     Date1,Date2:TDate;
    begin
      Date1:=StrToDate('2001/05/06');
      Date2:=StrToDate('2001/05/09');
      Result:=FloatToStr(Date2-Date1);
    end;
      

  13.   

    Delphi的帮助里写得很清楚:一个TDateTime就是一个Double,其中整数部分放从12/30/1899以来的天数,小数部分放当天已过去的时间。
    下面的我懒得翻译了:
    To find the fractional number of days between two dates, simply subtract the two values. Likewise, to increment a date and time value by a certain fractional number of days, simply add the fractional number to the date and time value.
      

  14.   

    想做倒记时吗?我有网页上的倒记时方法!Email:[email protected]