unit Timer;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, DateUtils;
type
TForm1 =
class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Label3: TLabel;
DerTimer: TTimer;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure DerTimerTimer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Zeit1 : TDateTime;
Zeit2 : TDateTime;
D : TDateTime;
S :
String;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DerTimer.Enabled := True;
Zeit1 := EncodeDate(2005, 12, 14)+EncodeTime(19, 8, 0, 0);
Zeit2 := Date+Time;
end;
procedure TForm1.DerTimerTimer(Sender: TObject);
begin
D := Abs(Zeit1 - Zeit2);
S := FormatDateTime('
hh:nn:ss', Zeit1 - Zeit2);
If D >= 1
Then S := IntToStr(Trunc(D)) + '
Tage ' + S;
Label1.Caption := FormatDateTime('
hh:nn:ss', Zeit1);
Label2.Caption := FormatDateTime('
hh:nn:ss', Zeit2);
Label3.Caption := S;
end;
end.