如果你用Delphi5,下面使用Help中的例子拼的一个程序,少做修改不难达到目的。<br>type<br> TForm1 = class(TForm)<br> Timer1: TTimer;<br> Button1: TButton;<br> Label1: TLabel;<br> Label2: TLabel;<br> procedure Timer1Timer(Sender: TObject);<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>var<br> DateTime : TDateTime;<br> str : string;<br>begin<br> DateTime := Time; // store the current date and time<br> str := TimeToStr(DateTime); // convert the time into a string<br> Caption := str; // display the time on the form's caption<br> { Note This could have been done with the following line of code:<br> Caption := TimeToStr(Time); }<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> Present: TDateTime;<br> Year, Month, Day, Hour, Min, Sec, MSec: Word;<br> begin<br> Present:= Now;<br> DecodeDate(Present, Year, Month, Day);<br> Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '<br> + IntToStr(Month) + ' of Year ' + IntToStr(Year);<br> DecodeTime(Present, Hour, Min, Sec, MSec);<br> Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '<br> + IntToStr(Hour);<br>end;<br>