请教一下DecodeTime()函数和EncodeTime()的使用方法?

解决方案 »

  1.   

    帮助中example;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;procedure TForm1.Button1Click(Sender: TObject);var
      MyTime: TDateTime;
    begin
      MyTime := EncodeTime(0, 45, 45, 7);
      Label1.Caption := TimeToStr(MyTime);
    end;