Autor Beitrag
schdom14
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39

Win XP
D7 Enterprise
BeitragVerfasst: So 07.09.03 09:36 
Hi Leute,

hab ma wieder ein problem :D Kann mir vieleicht jemand sagen wie ich ein Zufallsdatum z.b im Zeitraum vom 01.01.1960 bis zum 31.12.1980 generieren kann ???? Wäre echt wichtig.

Thx

Moderiert von user profile iconTino: Titel geändert & Topic verschoben.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: So 07.09.03 09:53 
ausblenden 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:
procedure TForm1.Button1Click(Sender: TObject);
Var d1,d2:Tdate;
    Var i:integer;
begin
  //erstmal die Werte ermitteln brauchst du einmal und die Werte aufschreiben ;)
  d1:=StrToDateTime('01.01.1960');
  ListBox1.Items.Add(inttostr(trunc(d1)));   //=21916
  d2:=StrToDateTime('31.12.1980');
  ListBox1.Items.Add(inttostr(trunc(d2)));   //=29586
  ListBox1.Items.Add('Diff:'+inttostr(trunc(d2-d1))); //7670

  //Zufallszahlen
  for i:=1 to 200 do
    begin
      d1:=random(7670)+21917;
      listbox1.Items.add(DateToStr(d1));
    end;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  randomize;
end;

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
schdom14 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39

Win XP
D7 Enterprise
BeitragVerfasst: So 07.09.03 10:11 
cool, danke für die schnelle antwort.
hat super gekllapt, soviele brauch ich nicht mal :wink:
eins hätte es auch getan. :D

Danke für deine Hilfe