Autor Beitrag
basti_1984
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Linux, Win Xp, Win 2000
Delphi, C, C++, PHP,
BeitragVerfasst: Mo 12.02.07 11:39 
Hallo, ich abe in meinem Formular zwei TdateTimePicker. Ich möchte das man auf knopfdruck alle tage ermittelt bekommt die zwischen diesen beiden Datumsangaben liegen.
Beispiel.
Picker1 : 4.5.2007
Picker2 : 8.5.2007

Ergebniss : 4.5.2007, 5.5.1007, 6.5.2007, 7.5.2007 und 8.5.2007.

Wie macht man das, ich habe an eine schleife gedacht wo ich den wert von picker1 solnage erhöhe bis er gleich dem wert von picker 2 ist . aber das geht nicht, irgendwie endlosschleife.

_________________
Wissen ist Macht. Nichts zu Wissen macht auch nichts
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 12.02.07 11:43 
Das sind TDateTimePicker. da führt ein Vergleich auf "Gleichheit" schnell mal zu unerwünschten Effekten. Probiere mal "größer gleich".
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 12.02.07 11:52 
schau dir doch mal die funktion DaysBetween an. ausserdem kannst du mal im forum suchen, vor ein paar wochen gabs da mal einen thread wie man da am besten die anzahl der tage ermittelt. <HTH>
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 12.02.07 11:59 
Es bringt ihm ja theoretisch nichts zu wissen, wie viele Tage dazwischen liegen. Probier mal die Methode von user profile iconjasocul zuerst.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 12.02.07 12:59 
gut, falsch gelesen, dafür 'n codebeispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var
 i,j: integer;
 d: tdate;
begin
 i := trunc(datetimepicker2.date) - trunc(datetimepicker1.date);
 d := datetimepicker1.Date;
 for j := 0 to i do
 begin
  d := d + 1;
  listbox1.items.add(datetostr(d));
 end;
end;
basti_1984 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 104

Linux, Win Xp, Win 2000
Delphi, C, C++, PHP,
BeitragVerfasst: Mo 12.02.07 13:02 
user profile iconGrenzgaenger hat folgendes geschrieben:
gut, falsch gelesen, dafür 'n codebeispiel:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var
 i,j: integer;
 d: tdate;
begin
 i := trunc(datetimepicker2.date) - trunc(datetimepicker1.date);
 d := datetimepicker1.Date;
 for j := 0 to i do
 begin
  d := d + 1;
  listbox1.items.add(datetostr(d));
 end;
end;


Danke hat funktioniert

_________________
Wissen ist Macht. Nichts zu Wissen macht auch nichts