Autor Beitrag
Terminator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34


D6 Prof
BeitragVerfasst: Mo 17.10.05 10:18 
Hallo Zusammen,

wie kann ich das Datum anhand der Angabe von der Kalenderwoche und dem entsprechenden Jahr herausfinden (Delphi 6).

Beispiel: KW 10
Jahr 2005

So nun bäuchte ich das dem entsprechende Datum dazu, ist dies möglich?

_________________
Man muss nicht alles glauben, was stimmt!
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 17.10.05 10:49 
In den SysUtils gibt es DayOfWeek.
Terminator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34


D6 Prof
BeitragVerfasst: Mo 17.10.05 11:28 
Danke schonmal für die Antwort.

Ich möchte jedoch kein Datum in dem Sinn übergeben, sondern eine Wochennummer z.B. 10 im Jahr 2005.

Das wäre in dem Fall der 07.03.2005 (KW 10 Jahr 2005)


DayOfWeek erwartet nämlich einen TDateTime-Wert ?!?

_________________
Man muss nicht alles glauben, was stimmt!
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 17.10.05 11:37 
Sorry, war mein Fehler.
Die Funktion gibt dir nur den Wochentag zurück. Ich meine, dass ich irgendwo eine Routine habe. Muss ich aber erst suchen.

So, die Routine kann ich dir leider nicht geben. Ist nicht von mir. Aber eine Tipp, wie man da ran gehen könnte, kann ich dir schon geben.
Hier findest du Hinweise, wie man die Kalenderwoche bestimmt (benötigt man für den Ansatz).
Dann prüfst du vom 1.1. bis zum 31.12. des Jahres, ob du in der Kalenderwoche gelandet bist. So bekommst du dann das passende Datum raus.
espen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 90
Erhaltene Danke: 1


D6 Prof./D7 Prof. MSSQL, MySQL
BeitragVerfasst: Mo 17.10.05 13:05 
Sollte eigentlich so funktionieren:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
uses
  DateUtils;

var
  dtmResult : TDateTime;
begin
  TryEncodeDateWeek(200510, dtmResult);
  showmessage(DateTimeToStr(dtmResult));
end;


Gruss,
Espen
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 17.10.05 13:37 
In D5 gabs das noch nicht. Wenn es das schon ab D6 gibt, dann kann er es ja benutzen.
Terminator Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34


D6 Prof
BeitragVerfasst: Mo 17.10.05 14:42 
VIELEN DANK!

Habs jetzt so gelöst

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var
  dtmResult : TDateTime;
begin
  dtmResult := EncodeDateWeek(200510);
  showmessage(DateTimeToStr(dtmResult));
end;



....gottesidank bietet D6 diese Funktionen ;)

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.

_________________
Man muss nicht alles glauben, was stimmt!