Autor Beitrag
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 09.10.02 19:50 
hallo !!!


ich frage per Indy Kompo von einem Zeitserver die Zeit ab.
das problem ist, dass die server mir nicht sommer bzw. winterzeit zurückgeben.
wie kann ich die zeit nachbearbeiten ??

_________________
In the beginning was the word.
And the word was content-type: text/plain.
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Do 10.10.02 10:24 
Hi
weiss nicht ob dir das konkret hilft. Prüfung Datum/Zeit auf Sommerzeit:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
function CheckBRDSz(Datum: TDateTime): Boolean;
var
   y, m, d  : Word;
   sDat, eDat  : TDateTime;
begin
   DecodeDate(Datum, y, m, d);
   if  y < 1981 then
       Result := False
   else begin
       sDat := EncodeDate(y, 3, 31);
       sDat := sDat - (DayOfWeek(sDat) - 1) + Frac(StrToTime('02:00'));
       eDat := EncodeDate(y, 10 - Word(y <= 1995), 31 - Word(y <= 1995));
       eDat := eDat - (DayOfWeek(eDat) - 1) + Frac(StrToTime('03:00'));
       Result := (Datum >= sDat) and (Datum < eDat);
   end;
end;

Die Regelungen in den Kriegsjahren und das Einführungsjahr 1980 wird allerdings nicht berücksichtigt.
Wenn du die vom Zeitserver empfangene Zeit mit dem Datum in einen TDateTime konvertierst, könntest du abchecken obs in die Sommerzeit fällt und dann eben eine Stunde draufaddieren.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...


Zuletzt bearbeitet von LCS am Do 10.10.02 11:56, insgesamt 1-mal bearbeitet
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 10.10.02 10:57 
Hi!

@LCS: Toller Code. Wäre ich im Leben nie drauf gekommen. Hätte noch nicht einmal gewusst, wann Sommer- und Winterzeit eingeführt wurde.

@matze: wenn Du die API-Funktion
ausblenden Quelltext
1:
GetTimeZoneInforamtion(TIME_ZONE_INFORMATION)					

verwendest, wird in TIME_ZONE_INFORMATION --> DaylightBias Informationen zu Sommer- und Winterzeit gespeichert. Ich weiß nicht, ob Dich das weiterbringt, wahrscheinlich nicht so sehr, wie der Code von LCS.

MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Do 10.10.02 15:39 
also der code ist schon mal spitzenklasse !!!

aber wie addiere ich zu einem TDateTime wert eine stunde drauf ??

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 10.10.02 16:03 
ausblenden Quelltext
1:
MyDateTime := IncHour(MyDateTime,1);					

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 11.10.02 15:55 
danke !!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 11.10.02 16:53 
HALT !!!

Mein Delphi5 kennt IncHour nicht !! muss ich da irgendwas in uses einfügen ??

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Fr 11.10.02 17:11 
Hi!

Die Funktion ist bei mir in der Unit DateUtils enthalten.

MfG,
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
matze Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 12.10.02 07:59 
ich hab diese Unit aber nicht !!! Kannst du mir nen Downloadlink geben, oder mir die Unit per Mail schicken ??

_________________
In the beginning was the word.
And the word was content-type: text/plain.