怎样获得当前年?当前月?当前的号数?分开获得!

解决方案 »

  1.   

    var
      y, m ,d: Word;DecodeDate(Date, y, m, d);
      

  2.   

    Yearof(now)
    MonthOf(now)
    dayof(now);
    剩下类推。
      

  3.   

    我这样ShowMessage(DateToStr(Yearof(now)));但是显示出来的是1905-6-26.
      

  4.   

    ShowMessage(inttostr(Yearof(now)));  这样就可以了
      

  5.   

    //取时间函数
    function GetDateTime():String;
    var
      Mydatetime : _SYSTEMTIME;
    begin
      Getsystemtime(Mydatetime);
      with Mydatetime do
        result := inttostr(wYear) +'-'+ inttostr(wMonth) +'-'+ inttostr(wDay) +' '+ inttostr(wHour) +':'+ inttostr(wMinute) +':'+ inttostr(wSecond);
    //你可以具体处理,想返回时间的哪个部分都行.
    end;结构:
    typedef struct _SYSTEMTIME {  // st  
        WORD wYear; 
        WORD wMonth; 
        WORD wDayOfWeek; 
        WORD wDay; 
        WORD wHour; 
        WORD wMinute; 
        WORD wSecond; 
        WORD wMilliseconds; 
    } SYSTEMTIME; 具体看MSDN,最根本的方法.