(Gast)
n/a Beiträge
|
Re: Problem mit Countdown
1. Aug 2007, 11:29
Probier's mal so
Delphi-Quellcode:
Procedure TForm1.Timer1Timer(Sender: TObject);
Var
dtTargetDate: TDateTime;
dtDiff: TDateTime;
Begin
//Das Zieldatum
dtTargetDate := StrToDateTime('03.08.2010 00:00:00');
//Differenz zw. Zieldatum und jetzt
dtDiff := dtTargetDate - Now;
//Zeitelemente in den Labels darstellen
lblJahre.Caption := Format('Noch %s Jahre,', [FormatDateTime('yy', dtDiff)]);
lblTage.Caption := Format('%s Tage,', [FormatDateTime('dd', dtDiff)]);
lblStunden.Caption := Format('%s Stunden,', [FormatDateTime('hh', dtDiff)]);
lblMinuten.Caption := Format('%s Minuten,', [FormatDateTime('nn', dtDiff)]);
lblSekunden.Caption := Format('und %s Sekunden bis zum %s', [FormatDateTime('ss', dtDiff), DateTimeToStr(dtTargetDate)]);
End;
|
|
Zitat
|