function YearsBetween(const ANow, AThen: TDateTime): Integer;

解决方案 »

  1.   

    (t1-t2)div 365
    我想这个不用太精确吧,差个一两天谁知道啊!TO:chechy
    老大的肝肝好了?
      

  2.   

    function YearsBetween(const ANow, AThen: TDateTime): Integer; 
      

  3.   

    YearsBetween  ?
    定义在什么地方 ?
    我为什么没有见过这个函数 ?
      

  4.   

    我照chechy老大说的查到的帮助如下:YearsBetween functionReturns the approximate number of years between two specified TDateTime values.UnitDateUtilsCategorydate/time routinesfunction YearsBetween(const ANow, AThen: TDateTime): Integer;DescriptionCall YearsBetween to obtain the difference, in years, between two TDateTime values. Because years are not all the same length (e.g. leap years), YearsBetween returns an approximation based on an assumption of 365.25 days per year. Fractional years are not counted. Thus, for example, YearsBetween reports the difference between Jan 1 and Dec 31 as 0 on non-leap years and 1 on leap years.
      

  5.   

    谢谢各位,我刚学DELPHI
    能不能举个例子?
      

  6.   

    用一个存储过程可以解决。(用MSSQL SERVER)