unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Button1: TButton;
Button2: TButton;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Timer1.Enabled:=false;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
DateTime : TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
DateTime:= Now;
DecodeDate(DateTime, Year, Month, Day);
Label1.Caption:='Year: '+Inttostr(Year);
Label2.Caption:='Month: '+Inttostr(Month);
Label3.Caption:='Day: '+Inttostr(Day);
DecodeTime(DateTime, Hour, Min, Sec, MSec);
Label4.Caption:='Hour: '+Inttostr(Hour);
Label5.Caption:='Min: '+Inttostr(Min);
Label6.Caption:='Sec: '+Inttostr(Sec);
Label7.Caption:='MSec: '+Inttostr(Msec);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
end.