datetimepicker控件取得的日期怎么分离年月日三项为strYear,strMonth,strDay?
谢谢!~~~

解决方案 »

  1.   

    var
      Year, Month, Day: Word;
    begin
      DecodeDate(datetimepicker.date, Year, Month, Day)
    end;
      

  2.   

    var
      Present: TDateTime;
      Year, Month, Day: Word;
    begin
      Present:= Now;
      DecodeDate(Present, Year, Month, Day);
    end;
      

  3.   

    Unit
    DateUtilsfunction YearOf(const AValue: TDateTime): Word;
    function MonthOf(const AValue: TDateTime): Word;
    function WeekOf(const AValue: TDateTime): Word;
    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;
      

  4.   

    DecodeDate(datetimepicker.DateTime, Year, Month, Day)
      

  5.   

    可以用formatdatatime实现
    也可以用截取字符串的形式得到你想要的形式
      

  6.   

    用formatdatetime阿,要年就edit1.Text:=formatdatetime('yyyy',datetimepicker1.Date);
      

  7.   

    我们这些初学者去哪里找这些函数? 有人整理了这些基本函数大全吗? 谁有?!
    [email protected]
    谢谢了~~~
      

  8.   

    delphi的帮助,不能关键字检索,而且我的还是英文版的~~!
      

  9.   

    DecodeDate(datetimepicker.date, Year, Month, Day)
      

  10.   

    用这个函数就行
    DecodeDate(datetimepicker.date, Year, Month, Day)