如果是用SQL的话可以用yeah()函数来提取年...month()..day()

解决方案 »

  1.   

    在DELPHI里面的话,decodedate()和encodedate()
    自己看一下HELP吧,我记不清了!
      

  2.   

    var
      Present: TDateTime;
      Year, Month, Day, Hour, Min, Sec, MSec: Word;
     begin
      Present:= Now;
      DecodeDate(Present, Year, Month, Day);
      DecodeTime(Present, Hour, Min, Sec,Msec);
     end;
      

  3.   

    才5分呀,老兄,怎么不多一点?
    就算是5分都给我!
    var
    aaa,bbb,ccc:string;
    begin
    aaa:=formatdatetime('YYYY',date);
    bbb:=formatdatetime('MM',date);
    ccc:=formatdatetime('DD',date);
    请马上结帖子吧!!
      

  4.   

    var
      YY,MM,DD:Word;
      OneDate:TDate;
    begin
      OneDate:=Date;
      DecodeDate(OneDate,YY,MM,DD);
    end;
      

  5.   

    如是Delphi6的话
    Ueses 个DateUtils;
    function YearOf(const AValue: TDateTime): Word;
    function MonthOf(const AValue: TDateTime): Word;
    function WeekOf(const AValue: TDateTime): Word;                       {ISO 8601}
    function DayOf(const AValue: TDateTime): Word;
    function HourOf(const AValue: TDateTime): Word;
    function MinuteOf(const AValue: TDateTime): Word;
    function SecondOf(const AValue: TDateTime): Word;
    function MilliSecondOf(const AValue: TDateTime): Word;