Autor Beitrag
kiwicht
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Mo 23.06.03 07:49 
Hab folgendes Problem:

Auf Knopfdruck wird aus einem Edit-Feld eine Variabe ausgelesen. Diese Variable soll insgesamt 6 mal inkrementiert werden, und auf 7 Panels jeweils ein fortlaufendes Datum anzeigen.
Quasi ein Terminkalender.

Ich nutze also folgende Prozedure:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Datum := StrToDate(edit1.text);
panel1.caption := days[DayOfWeek(Datum)] + ' - ' + DateToStr(Datum);
Datum := Datum + 1;
panel2.caption := days[DayOfWeek(Datum)] + ' - ' + DateToStr(Datum);
Datum := Datum + 1;
panel3.caption := days[DayOfWeek(Datum)] + ' - ' + DateToStr(Datum);
Datum := Datum + 1;
panel4.caption := days[DayOfWeek(Datum)] + ' - ' + DateToStr(Datum);
Datum := Datum + 1;
panel5.caption := days[DayOfWeek(Datum)] + ' - ' + DateToStr(Datum);
Datum := Datum + 1;
panel6.caption := days[DayOfWeek(Datum)] + ' - ' + DateToStr(Datum);
Datum := Datum + 1;
panel7.caption := days[DayOfWeek(Datum)] + ' - ' + DateToStr(Datum);


"days" wird im OnCreate-Ereigniss meiner Form folgendermassen deklariert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
days : array[1..7of String;
days[1] := 'Montag';
days[2] := 'Dienstag';
days[3] := 'Mittwoch';
days[4] := 'Donnerstag';
days[5] := 'Freitag';
days[6] := 'Samstag';
days[7] := 'Sonntag';


Tja, und drücke ich jetzt auf den Button, nachdem ich das heutige Datum, also 23.06.2003, eingeben habe, fängt er an, die Panels zu füllen.
Soweit so gut. Aber er ordnet dem 23.06.2003 Dienstag zu.

Falsch.

Weiß einer woran das liegen könnte?

vielen Dank schonma

mfG

//EDIT
ich glaub ich hab ne Vermutung: Delphi behandelt den Sonntag als 1. Tag der Woche, und ich glaube das konnte man irgendwo einstellen.... aber wo?


Zuletzt bearbeitet von kiwicht am Mo 23.06.03 10:31, insgesamt 1-mal bearbeitet
MAlsleben
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 303

W2k,WinXP
D3 - DXE3 Enterprise
BeitragVerfasst: Mo 23.06.03 09:10 
Hi,

Sonntag ist der Tag 1 usw. lt. Delphi- Hilfe.

_________________
Viele Wege führen nach Rom.
AndyB
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1173
Erhaltene Danke: 14


RAD Studio XE2
BeitragVerfasst: Mo 23.06.03 10:06 
DayOfWeek ist nicht ISO 8601 konform. Die ISO 8601 konforme Funktion ist DayOfTheWeek aus der Unit DateUtils. Bei dieser ist Montag der 1. Tag in der Woche.

_________________
Ist Zeit wirklich Geld?
kiwicht Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Mo 23.06.03 10:31 
:D

Danke! Funzt mit DayOfTheWeek!

Fein fein!

mfg
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Mo 23.06.03 12:43 
Du hättest auch einfach dein Array umschreiben können, d.h. Als erster Tag Sonntag und so weiter.

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
kiwicht Threadstarter
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Mo 23.06.03 12:45 
hm.. stimmt. Aber wozu einfach machen wenns auch umständlich geht =)
Tweafis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 647

WinXP + fbsd
Delphi 5 Prof
BeitragVerfasst: Mo 23.06.03 12:56 
Jo, gute Einstellung ;)

_________________
.: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.