怎样把现在时间的年月日提取出来

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);begin
      Label1.Caption := 'Today is  ' + DateToStr(Date);end;
      

  2.   

    我打错了,是ShowMessage(DateTimeToStr(Date));
      

  3.   

    This example uses a button and two labels on a form. When the user clicks the button, the current date and time are reported in the captions of the two labels.procedure TForm1.Button1Click(Sender: TObject);var
      Present: TDateTime;
      Year, Month, Day, Hour, Min, Sec, MSec: Word;
     begin
      Present:= Now;
      DecodeDate(Present, Year, Month, Day);
      Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
        + IntToStr(Month) + ' of Year ' + IntToStr(Year);
      DecodeTime(Present, Hour, Min, Sec, MSec);
      Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
        + IntToStr(Hour);
    end;
      

  4.   

    decode //提取时间
    encode //组合时间