我用DELPHI +SQL SERVER 做的系统
请问是在DELPHI 里做还是在SQL SERVER里做呀!
都是怎么实现的
有一个字段是"出生日期"
谢谢!!

解决方案 »

  1.   

    select DATEDIFF ( yyyy , startdate , enddate ) as FAge from tblName
      

  2.   

    DateUtilsCategorydate/time routinesfunction YearSpan(const ANow, AThen: TDateTime): Double;
      

  3.   

    DateUtilsCategorydate/time routinesfunction YearsBetween(const ANow, AThen: TDateTime): Integer;
      

  4.   

    不过这样算的是虚岁,也可以在DELPHI中用计算字段实现
      

  5.   

    var
      birthday:Tdatetime;
      year,month,day:word;
      birthdayYear,DateYear,age:integer;
    begin
      decodedate(birthday,year,month,day);
        birthdayyear:=year;
      decodedate(Date,year,month,day);
        dateaayear:=year;
      Age:=Dateyear-Birthdayyear;
     
    end;