| |
|
|
- Page 1 - |
|
 | exists The Possibility, whom String the windows-Zeitzone auszulesen ? In this case: "Amsterdam, Berlin, Bern etc..." - see Image if so, small Help would nice  |
|
|
| |
|
|
|
| |
|
- Page 1 - |
|
 Jörg Sellmeyer | so ought to you first helped his. CompileMarkSeparation $H Windows.ph
Def GetTimeZoneInformation(1) !"Kernel32","GetTimeZoneInformation"
Struct TIME_ZONE_INFORMATION = Bias&,
StandardName$(32),
StandardDate&, hier steht eigentlich eine Struktur, die das Standarddatum aufnimmt
StandardBias&,
DaylightName$(32),
DaylightDate&, hier steht eigentlich eine Struktur, die das Standarddaylightdatum aufnimmt
DaylightBias&
Declare TZI#
Dim TZI#,TIME_ZONE_INFORMATION
Print GetTimeZoneInformation(TZI#)
Print ~TIME_ZONE_ID_UNKNOWN,~TIME_ZONE_ID_UNKNOWN, ~TIME_ZONE_ID_DAYLIGHT
With TZI#
für Dich sind diese beiden Werte interessant:
Print .Bias&
Bias& zeigt den Unterchied in Minuten zu GMT. Hier sind es -60. Das heißt es ist um eine Zeitzone verschoben.
Print .StandardName$
Print Translate$(Char$(TZI#,4,60),"z","")
Hier wird die Zeitzone im Klartext (Widestring - deshalb Translate) widergegeben
EndWith
Dispose TZI#
WaitInput
|
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 09/22/08 ▲ |
|
|
|
|
 | Runs even XP-Script (the Perform-Button)!  |
|
|
| |
|
|
|
 | @Grossen Thanks - Jörg 
The DEF I had already, only for the "Drumherum" had I yet some Time used !  |
|
|
| |
|
|
|
 Jörg Sellmeyer | But certainly not yet correctly. Basiert hierauf:
typedef struct _TIME_ZONE_INFORMATION { // tzi LONG Bias; WCHAR StandardName[ 32 ]; SYSTEMTIME StandardDate; LONG StandardBias; WCHAR DaylightName[ 32 ]; SYSTEMTIME DaylightDate; LONG DaylightBias; } TIME_ZONE_INFORMATION;
These WCHAR must evtl. differently installed will be and, How already erwähnt, The Structures are missing. but it functions first. though there Westeuropäische Normalzeit from. ought to but really Sommerzeit spit out. Can but to hardship by the Return Value the function detect (see code supra) |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 09/22/08 ▲ |
|
|
|
|
 Gerhard Praher | any available Zeitzonen find You too in the Registry.
and of course under:
HKEY_LOCAL_MACHINESoftwareMircorsoftWindows NTCurrentVersionTime Zones
Greeting Gerhard |
|
|
| Windows XP Pro, SP3 Jetzt: XProfan 11 Was ich liebe sind 3 "F": meine Familie, meine Firma, meine Freizeit. | 09/22/08 ▲ |
|
|
|
|
 Dieter Zornow | so becomes too The Sommerzeit displayed, tappt im dunkeln standing in Daylightname, but I faith only, if the User automatic Zeitumstellung abgehakt has. with Daylight date be I I do not sure which date eingefügt go must. I have time whom Beginn the Sommerzeit eingefügt CompileMarkSeparationdef GetTimeZoneInformation(1) !"KERNEL32", "GetTimeZoneInformation"
def GetSystemTime(1) ! "Kernel32","GetSystemTime"
struct TIME_ZONE_INFORMATION = Bias&,
StandardName$(63),
StandardDate#(16),
StandardBias&,
DaylightName$(63),
DaylightDate#(16),
DaylightBias&
declare TimeZone#,systime#
dim systime#,16
dim TimeZone#, TIME_ZONE_INFORMATION
clear timezone#
cls
GetSystemTime(systime#)
timezone#.StandardDate# =
WORD(systime#,0),
WORD(systime#,2),
WORD(systime#,4),
WORD(systime#,6),
WORD(systime#,8),
WORD(systime#,10),
WORD(systime#,12),
WORD(systime#,14)
timezone#.DaylightDate# =
2008,
3,
0,
30,
2,
0,
0,
0
Print GetTimeZoneInformation(TimeZone#)
with TimeZone#
print .Bias&
print .StandardName$
Print Translate$(Char$(TimeZone#,4,63),"z","")
print .StandardDate#
print .StandardBias&
print .DaylightName$
print Translate$(Char$(TimeZone#,87,63),"z","")
print .DaylightDate#
print .DaylightBias&
endwith
dispose TimeZone#,systime#
waitinput
/../Function-References/XProfan/end/'>end
|
|
|
| Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 09/22/08 ▲ |
|
|
|
|
 | @Dieter + Jörg
thanks on both 
me went it in first line circa:
.DaylightBias& Translate$(Char$(TimeZone#,87,63),"z","")
...and the have I now  |
|
|
| |
|
|
|
 RGH | ... and here The direct Translation the VisualBasic-Codes to XProfan. there XProfan (yet) something economical with installed Datumsroutinen is, have I some Hilfsfunktiionen added and four Lines Hauptprogramm The The procedure example() Call.
deference: The code is because of the verschachtelten Structures first ex XProfan 11 run! it shows but very beautiful, How Structures iun Structures To use are. (How it to XProfan 11went, show Yes The Posts the Vorposter.) CompileMarkSeparation// -------------------------------------------------------------------------------------
// Dieser Codeausschnitt ermittelt verschiedene Zeitzoneninformationen und bedient sich
// dabei des Win32-API. Folgende Funktionen stehen zur Verfügung:
// -------------------------------------------------------------------------------------
// Funktion: Beschreibung:
// -------------------------------------------------------------------------------------
// DaylightSavingExists Ermittelt, ob die Zeitzone (des Systems) eine Sommerzeit hat
// DaylightSaving Ermittelt, ob Sommerzeit besteht
// DaylightBias Ermittelt die Sommerzeit-Zeitverschiebung gegenüber GMT-Uhrzeit in Minuten
// StandardBias Ermittelt die die Standardzeit-Zeitverschiebung gegenüber GMT-Uhrzeit in Minuten
// CurrentBias Ermittelt die aktuelle Zeitverschiebung gegenüber GMT-Uhrzeit in Minuten
// DaylightName Ermittelt den Klartextnamen der Sommerzeit-Zeitzone
// StandardName Ermittelt den Klartextnamen der Standardzeit-Zeitzone
// GMTTime Ermittelt die aktuelle GMT-Uhrzeit (inkl. Datum)
// FirstDateDaylight Ermittelt das Startdatum der Sommerzeit
// FirstDateStandard Ermittelt das Startdatum der Standardzeit
// -------------------------------------------------------------------------------------
Def &TIME_ZONE_ID_DAYLIGHT 2
Struct SYSTEMTIME =
wYear%,
wMonth%,
wDayOfWeek%,
wDay%,
wHour%,
wMinute%,
wSecond%,
wMilliseconds%
Struct TIME_ZONE_INFORMATION =
Bias&, Basis-Zeitverschiebung in Minuten
StandardName#(64), Name der Normalzeit-Zeitzone
StandardDate!SYSTEMTIME, Beginn der Standardzeit
StandardBias&, Zusätzliche Zeitverschiebung der Standardzeit
DaylightName#(64), Name der Sommerzeit-Zeitzone
DaylightDate!SYSTEMTIME, Beginn der Sommerzeit
DaylightBias& Zusätzliche Zeitverschiebung der Sommerzeit
Def GetTimeZoneInformation(1) !"kernel32", "GetTimeZoneInformation"
--------------- Datum-Hilfsfunktionen, die es in XProfan nicht gibt----------------------------
Proc DTFormat
gibt den Datumsteil von Data# als String zurück
Parameters Data#
Return Format$("00",Data#.wDay%)+"."+Format$("00",Data#.wMonth%)+"."+Format$("00",Data#.wYear%)+", "
+ Format$("00",Data#.wHour%)+":"+Format$("00",Data#.wMinute%)+":"+Format$("00",Data#.wSecond%)+" Uhr"
EndProc
Proc WeekDay
ermittelt den Wochentag des Datums
Parameters Year%, Month%, Day%
If (Month% < 3)
Month% = Month% + 12
Year% = Year% - 1
EndIf
Return (Day% + Int((13 * Month% - 27) / 5) + Year% + Int(Year% / 4) - Int(Year% / 100) + Int(Year% / 400)) MOD 7
EndProc
Proc LastDay
Ermittelt den letzten Tag des Monats im angegebenen Jahr
Parameters Year%, Month%
Declare Last%
Select Month%
CaseOf 1,3,5,7,8,10,12
Last% = 31
CaseOf 2
Last% = 28 + ((Year% mod 4) = 0) - ((Year% mod 100) = 0) + ((Year% mod 400) = 0)
OtherWise
Last% = 30
EndSelect
Return Last%
EndProc
Proc DateAddMinutes
Fügt dem DatumZeit-Objekt Date# die Minuten hinzu bzw. zieht sie ab
Parameters Data#, Minutes%
With Data#
.wMinute% = .wMinute% + Minutes% mod 60
.wHour% = .wHour% + Minutes% 60
if .wHour% > 23
.wHour% = .wHour% - 24
.wDay% = .wDay% + 1
endif
if .wDay% > LastDay(.wYear%,.wMonth%)
.wDay% = .wDay% - LastDay(.wYear%,.wMonth%)
.wMonth% = .wMonth% + 1
endif
if .wMonth% > 12
.wMonth% = .wMonth% - 12
.wYear% = .wYear% + 1
endif
if .wHour% < 0
.wHour% = .wHour% + 24
.wDay% = .wDay% - 1
endif
if .wDay% < 1
.wMonth% = .wMonth% - 1
.wDay% = .wDay% + LastDay(.wYear%,.wMonth%)
endif
if .wMonth% < 1
.wMonth% = .wMonth% + 12
.wYear% = .wYear% - 1
endif
EndWith
Return Data#
EndProc
-----------------------------------------------------------------------------------------
PROC Beispiel
Print "Aktuelle Zeit"
Print "-------------"
Print "Aktuelle Lokalzeit: "; Date$(0); ", "; Time$(0); ":"; Left$(Time$(1),2); " Uhr"
Print "Aktuelle GMT-Zeit: "; DTFormat(GMTTime())
Print "Sommerzeit: "; If(DaylightSaving(), "Ja", "Nein")
Print
Print "Standardzeit"
Print "------------"
Print "Name der Standardzeit: "; StandardName()
Print "Beginn der Standardzeit: "; FirstDateStandard(0)
Print "Zeitverschiebung: "; "GMT" + If(StandardBias() < 0, "", "+") + Str$(Int(StandardBias())) + " Minuten"
Print
Print "Sommerzeit"
Print "----------"
If DaylightSavingExists()
Print "Name der Sommerzeit: "; DaylightName()
Print "Beginn der Sommerzeit: "; FirstDateDaylight(0)
Print "Zeitverschiebung: "; "GMT" + If(DaylightBias() < 0, "", "+") + Str$(Int(DaylightBias())) + " Minuten"
Else
Print "Zeitzone hat keine Sommerzeit!"
EndIf
EndProc
Proc DaylightSavingExists
// Gibt zurück, ob die Zeitzone eine Sommerzeit hat.
Var udtTZI# = New(TIME_ZONE_INFORMATION)
GetTimeZoneInformation(udtTZI#)
Return (udtTZI#.DaylightDate!wMonth% <> 0)
EndProc
Proc DaylightSaving
// Gibt zurück, ob Sommerzeit besteht.
Var udtTZI# = New(TIME_ZONE_INFORMATION)
Var RetVal& = GetTimeZoneInformation(udtTZI#)
Return (RetVal& = &TIME_ZONE_ID_DAYLIGHT)
EndProc
Proc StandardBias
// Gibt die Standardzeit-Zeitverschiebung
// gegenüber GMT-Uhrzeit in Minuten zurück.
Var udtTZI# = New(TIME_ZONE_INFORMATION)
GetTimeZoneInformation(udtTZI#)
Return -(udtTZI#.Bias& + udtTZI#.StandardBias&)
EndProc
Proc DaylightBias
// Gibt die Sommerzeit-Zeitverschiebung
// gegenüber GMT-Uhrzeit in Minuten zurück.
Var udtTZI# = New(TIME_ZONE_INFORMATION)
GetTimeZoneInformation(udtTZI#)
Return -(udtTZI#.Bias& + udtTZI#.DaylightBias&)
EndProc
Proc CurrentBias
// Gibt die aktuelle Zeitverschiebung
// gegenüber GMT-Uhrzeit in Minuten zurück.
Var udtTZI# = New(TIME_ZONE_INFORMATION)
Var RetVal& = 0
RetVal& = GetTimeZoneInformation(udtTZI#)
With udtTZI#
If RetVal& = &TIME_ZONE_ID_DAYLIGHT
RetVal& = -(.Bias& + .DaylightBias&)
Else
RetVal& = -(.Bias& + .StandardBias&)
EndIf
EndWith
Return RetVal&
EndProc
Proc DaylightName
// Gibt den Klartextnamen der Sommerzeit-Zeitzone zurück.
Var udtTZI# = New(TIME_ZONE_INFORMATION)
GetTimeZoneInformation(udtTZI#)
Return Translate$(Char$(udtTZI#,88,63),"z","")
EndProc
Proc StandardName
// Gibt den Klartextnamen der Standardzeit-Zeitzone zurück.
Var udtTZI# = new(TIME_ZONE_INFORMATION)
GetTimeZoneInformation(udtTZI#)
Return Translate$(Char$(udtTZI#,4,63),"z","")
EndProc
Proc GMTTime
// Gibt die aktuelle GMT-Uhrzeit (inkl. Datum) zurück.
GMTTime = DateAdd("n", -CurrentBias(), Now)
Var Date# = new(SYSTEMTIME)
Var Bias% = CurrentBias()
With Date#
.wYear% = Val(Left$(Date$(3),4))
.wMonth% = Val(Mid$(Date$(3),5,2))
.wDay% = Val(Right$(Date$(3),2))
.wHour% = Val(Left$(Time$(0),2))
.wMinute% = Val(Right$(Time$(0),2))
.wSecond% = Val(Left$(Time$(1),2))
EndWith
Return DateAddMinutes(Date#,Bias%)
EndProc
Proc FirstDateDaylight
// Gibt das Startdatum der Sommerzeit zurück.
Parameters InYear%
Var udtTZI# = new(TIME_ZONE_INFORMATION)
Var Date# = new(SYSTEMTIME)
Case InYear% = 0 : InYear% = Val(Left$(Date$(3),4))
GetTimeZoneInformation(udtTZI#)
In .wMonth steht der Monat der Umstellung
In .wDay steht die Woche der Umstellung
With udtTZI#
Date#.wYear% = .DaylightDate!wYear%
Date#.wMonth% = .DaylightDate!wMonth%
Date#.wDayOfWeek% = .DaylightDate!wDayOfWeek%
Date#.wDay% = .DaylightDate!wDay%
Date#.wHour% = .DaylightDate!wHour%
Date#.wMinute% = .DaylightDate!wMinute%
Date#.wSecond% = .DaylightDate!wSecond%
Date#.wMilliseconds% = .DaylightDate!wMilliseconds%
EndWith
Return GetTimezoneChangeDate(Date#, InYear%)
EndProc
Proc FirstDateStandard
// Gibt das Startdatum der Standardzeit zurück.
Parameters InYear%
Var udtTZI# = new(TIME_ZONE_INFORMATION)
Var Date# = new(SYSTEMTIME)
Case InYear% = 0 : InYear% = Val(Left$(Date$(3),4))
GetTimeZoneInformation(udtTZI#)
In .wMonth steht der Monat der Umstellung
In .wDay steht die Woche der Umstellung
With udtTZI#
Date#.wYear% = .StandardDate!wYear%
Date#.wMonth% = .StandardDate!wMonth%
Date#.wDayOfWeek% = .StandardDate!wDayOfWeek%
Date#.wDay% = .StandardDate!wDay%
Date#.wHour% = .StandardDate!wHour%
Date#.wMinute% = .StandardDate!wMinute%
Date#.wSecond% = .StandardDate!wSecond%
Date#.wMilliseconds% = .StandardDate!wMilliseconds%
EndWith
Return GetTimezoneChangeDate(Date#, InYear%)
EndProc
Proc GetTimezoneChangeDate
// In Data.wDayOfWeek wird ein Wochentag übergeben. Die Information in .wDay
// legt fest, in welcher Woche des Monats der betroffene Tag zu ermitteln
// ist.
Parameters Data#, InYear%
Var dtTemp# = new(SYSTEMTIME)
Var lMonthFirstWeekday& = 0
Var lMonthlastWeekday& = 0
With Data#
// Wochentag des ersten Tages im Monat berechnen
lMonthFirstWeekday& = Weekday(InYear%, .wMonth%, 1)
.wYear% = InYear%
// Den gesuchten Tag ermitteln
.wDay% = .wDayOfWeek% - lMonthFirstWeekday& + .wDay% * 7 + 1
Case .wDay% > LastDay(.wMonth%) : .wDay% = .wDay% - 7
EndWith
Return DTFormat(Data#)
EndProc
------------
TESTPROGRAMM
-----------< -
CLS
example()
WaitInput
End
Greeting Roland |
|
|
| Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 09/23/08 ▲ |
|
|
|
| |
|
- Page 2 - |
|
|
 | @Roland this is naturally one "Sahnehäuptchen" 
In my code have I with the the "Sommerzeit" so resolved: the Tool prepares at Start from the Code (Peter + Jörg) a temporary File. therein becomes DaylightBias& Translate$ (Char$(TimeZone#,87,63)," z","") stored.
Ausgelesen becomes as CompileMarkSeparation |
|
|
|
|
 Dieter Zornow | @Roland your code has a Error Reading the GMT -Time in "Proc DateAddMinutes", The deviation must always abgezogen go not add, otherwise appear one falser worth. is too with Microsoft described incorrectly. If How by me Südostasiatische Normalzeit comes what +7 or +420 corresponds to is GMT -7 or - 420, measured on of my Time., there You Yes whom Bias using.
See attachment
Greeting
Dieter |
|
|
| Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 10/05/08 ▲ |
|
|
|
|
 |
|
|
| |
|
|
|
 RGH | Hello, i will me not strangers feathers deck: this is not my code, separate a 1:1-Umsetzung the VB-Codes. Fachliche Error have I, so tappt im dunkeln because drin are, naturally übernommen!
Greeting Roland |
|
|
| Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4 | 10/05/08 ▲ |
|
|
|