![]() |
AW: Datum letzter Samstag?
Zitat:
|
AW: Datum letzter Samstag?
Zitat:
Es sollte auch Unittests zu Posts geben. :oops: Zitat:
|
AW: Datum letzter Samstag?
Wow... das ist ja fast wie die Relativitätstheorie. :roteyes:
Und letzter Sonntag wäre dann?
Delphi-Quellcode:
result := Date - DayOfWeek(Date) + 1;
|
AW: Datum letzter Samstag?
Zitat:
|
AW: Datum letzter Samstag?
Zitat:
Delphi-Quellcode:
Function LastDow (const DateToMatch : TDateTime; const DowToMatch : Byte) : TDateTime;
begin result := ( DateToMatch - 1 ) - ((DaysPerWeek - DowToMatch + DayOfTheWeek( DateToMatch - 1 )) mod DaysPerWeek); end; |
AW: Datum letzter Samstag?
Zitat:
|
AW: Datum letzter Samstag?
Zitat:
Zitat:
Delphi-Quellcode:
Und schon würde es bestimmt gut ins DateUtils rein passen.
function LastDow(DowToMatch: Word{selber Typ wie DayOfTheWeek ... k.A. warum es eventuell mehr als 255 Wochentage geben könnte}; DateToMatch: TDate=0; Weeks: Integer=-1): TDateTime;
begin if DateToMatch = 0 then DateToMatch = Date; Result := (DateToMatch - 1) - ((DaysPerWeek - DowToMatch + DayOfTheWeek(DateToMatch - 1)) mod DaysPerWeek) + (Weeks + 1) * DaysPerWeek; end; function NextDow(DowToMatch: Word; DateToMatch: TDate=0; Weeks: Integer=+1): ... // NextDow ist ja nicht einfach nur (LastDow + DaysPerWeek), jedenfalls nicht, falls das DateToMatch zufällig bereits der DowToMatch wäre. |
AW: Datum letzter Samstag?
Möchte jemand die Behandlung jetzt noch auf verschiedene Zeitzonen erweitern?
|
AW: Datum letzter Samstag?
Zitat:
|
AW: Datum letzter Samstag?
Zitat:
Aber wie wär es hier mit: London 7.00 Sonntag Vormittag welcher Wochentag ist in Wellington Gruß K-H |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:51 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz