Autor Beitrag
polysign
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Fr 21.05.04 12:39 
Hallo erstmal,

ich will mir ein Countdown Proggy zusammenstellen. Mir sollen die restlichen Tage bis zum Datum X ausgegeben werden. Darüber hinaus natürlich die Stunden, Minuten und Sekunden bis dahin.

Hat jemand ne Idee. Ich werde nicht schlau aus der ganzen Sache.
Danke im Voraus
Killmag10
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: Fr 21.05.04 13:10 
Titel: Re: Countdown - Tage bis zum Datum X und verbleibende Stunde
polysign hat folgendes geschrieben:
Hallo erstmal,

ich will mir ein Countdown Proggy zusammenstellen. Mir sollen die restlichen Tage bis zum Datum X ausgegeben werden. Darüber hinaus natürlich die Stunden, Minuten und Sekunden bis dahin.

Hat jemand ne Idee. Ich werde nicht schlau aus der ganzen Sache.
Danke im Voraus


jo

also du kannst das datum ganz einfach minus ein anderes rechnen.

ich hab mal hier in beispiel geschrieben:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
edit1.Text:=floattostr((strtotime('22:11:11')-time));
end;

end.


so zählst du zb die sekunden runder bis 22:11:11

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik
Killmag10
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: Fr 21.05.04 14:14 
Hier nochmal wie eine komplettes programm:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Timer1: TTimer;
    Edit2: TEdit;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
var
  Present: TDateTime;
  Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
Present:=(strtodate('11.11.05')+(strtotime('22:11:11'))-(date+time) ) ;

  DecodeDate(Present, Year, Month, Day);
  edit1.text :=  ' Jahre: ' + IntToStr(Year-1900)+' Monate: '+ IntToStr(Month)+' Tage: '+ IntToStr(Day);
  DecodeTime(Present, Hour, Min, Sec, MSec);
  edit2.text :=' Stunden: '  + IntToStr(Hour)+ ' Minuten: ' + IntToStr(Min)+' Sekunden: '+IntToStr(sec)

end;

end.


ich weis nett wie es bei andern betriebsystemen is aber bei win98 must du das jahr -1900 rechnen

mfg. Killmag10

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik
polysign Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Fr 21.05.04 14:40 
Super, DANKE DANKE!!!
Hat mich echt weitergebracht!!!!!!