Autor Beitrag
Mike19
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 256

Win XP, Vista, Win 7
Delphi 2005, Turbo Delphi
BeitragVerfasst: Mo 21.03.11 11:06 
Moderiert von user profile iconNarses: Abgetrennt von [url=branch.delphi-forum....rder=asc]hier[/url].

Nun die nächste Frage.

Gibt es eine Funktion, mit der ich aus dem Wert der Kalenderwoche das Datum von einem bestimmten Wochentag in dieser Woche ermitteln kann.

Beispiel:

WeekOf = 12
Day = 1

Datum wäre dann 21.März 2011

Danke für Eure Hilfe schon im voraus
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Mo 21.03.11 11:58 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Function GetDay4Week(Tag, Woche, Jahr:Word):TDateTime;
var
  i:Integer;
begin
  Result := StartOfTheWeek(EncodeDate(Jahr,1,1));
  while (Woche<=53and (WeekOf(Result) <> Woche) do Result := Result + 7;
  Result := Result + Tag - 1;

end;


gegf. noch Sonderfallprüfungen nötig

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19339
Erhaltene Danke: 1752

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 21.03.11 13:59 
StartOfAWeek macht bereits genau das alles. ;-)

Für diesen Beitrag haben gedankt: bummi
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Mo 21.03.11 14:04 
@jaenicke

danke, habe ich glatt übersehen...

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Mike19 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 256

Win XP, Vista, Win 7
Delphi 2005, Turbo Delphi
BeitragVerfasst: Mo 21.03.11 14:45 
Danke, klappt wunderbar.