| |
|
|
- Página 1 - |
|
 | Besteht el Möglichkeit, el String en el Windows-Zeitzone auszulesen ? In diesem Fall: "Amsterdam, Berlin, Bern usw..." - siehe Bild Wenn sí, kleine Ayuda wäre nett  |
|
|
| |
|
|
|
| |
|
- Página 1 - |
|
 Jörg Sellmeyer | Damit debería Usted primero geholfen ser. KompilierenMarcaSeparación $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 ...  | 22.09.2008 ▲ |
|
|
|
|
 | Läuft incluso con XP-Script (el Ausführen-Button)!  |
|
|
| |
|
|
|
 | @Grossen Dank - Jörg 
El DEF Tuve ya, sólo para el "Drumherum" hätte Todavía algunos Tiempo gebraucht !  |
|
|
| |
|
|
|
 Jörg Sellmeyer | Pero determinado todavía no korrekt. 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;
Diese WCHAR necesario evtl. anders instalado voluntad y, como ya erwähnt, el Estructuras fehlen. Aber lo funktioniert primero. Aunque hay Westeuropäische Normalzeit de. Müßte aber eigentlich Sommerzeit ausspucken. Kann uno aber a Not por el Rückgabewert el Función ermitteln (siehe Code oben) |
|
|
| Windows XP SP2 XProfan X4... und hier mal was ganz anderes als Profan ...  | 22.09.2008 ▲ |
|
|
|
|
 Gerhard Praher | Alle verfügbaren Zeitzonen findest du auch en el Registry.
Und zwar bajo:
HKEY_LOCAL_MACHINESoftwareMircorsoftWindows NTCurrentVersionTime Zones
Saludo Gerhard |
|
|
| Windows XP Pro, SP3 Jetzt: XProfan 11 Was ich liebe sind 3 "F": meine Familie, meine Firma, meine Freizeit. | 22.09.2008 ▲ |
|
|
|
|
 Dieter Zornow | So se auch el Sommerzeit adecuado, ellos es en Daylightname, pero yo glaube sólo, si la User automatische Zeitumstellung abgehakt ha. En Daylight Datum bin Yo no sicher welches Datum eingefügt voluntad muss. Yo habe veces el Beginn el Sommerzeit eingefügt KompilierenMarcaSeparacióndef 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
/../funktionsreferenzen/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 | 22.09.2008 ▲ |
|
|
|
|
 | @Dieter + Jörg
Gracias a Beide 
Mir ging lo en erster Linie en:
.DaylightBias& Translate$(Char$(TimeZone#,87,63),"z","")
...y el Yo ahora  |
|
|
| |
|
|
|
 RGH | ... y aquí el direkte Übersetzung des VisualBasic-Codes después de XProfan. Como XProfan (todavía) algo sparsam con eingebauten Datumsroutinen es, Yo algunos Hilfsfunktiionen hinzugefügt y vier Zeilen Hauptprogramm el el Procedimiento Ejemplo() aufrufen.
Achtung: Der Code es wegen el verschachtelten Estructuras sólo de XProfan 11 lauffähig! Er zeigt aber muy schön, como Estructuras iun Estructuras utilizarse son. (Como lo antes XProfan 11ging, zeigen sí el Beiträge el Vorposter.) KompilierenMarcaSeparación// -------------------------------------------------------------------------------------
// 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
Ejemplo()
WaitInput
End
Saludo 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 | 23.09.2008 ▲ |
|
|
|
| |
|
- Página 2 - |
|
|
 | @Roland Es natürlich una "Sahnehäuptchen" 
In mi Code Yo el con el "Sommerzeit" así gelöst: Das Tool erstellt beim Start de el Code de (Peter + Jörg) una temporäre Expediente. Darin se DaylightBias& Translate$ (Char$(TimeZone#,87,63)," z","") gespeichert.
Ausgelesen se como KompilierenMarcaSeparación |
|
|
|
|
 Dieter Zornow | @Roland Su Code ha una Fehler beim Auslesen el GMT -Tiempo en "Proc DateAddMinutes", el Abweichung muss siempre abgezogen voluntad no addiert, sonst erscheint una falscher Valor. Ist auch en Microsoft falso beschrieben. Wenn como en me Südostasiatische Normalzeit kommt qué +7 oder +420 entspricht es GMT -7 oder - 420, gemessen a meiner Tiempo., como du sí el Bias benutzt.
Siehe Anhang
Saludo
Dieter |
|
|
| Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 05.10.2008 ▲ |
|
|
|
|
 |
 | 61 kB | | Kurzbeschreibung: | So dürfte el Tiempo ahora korrekt adecuado voluntad. | | Hochgeladen: | 05.10.2008 | | Ladeanzahl: |  | | | Descargar |
|
|
| |
|
|
|
 RGH | ¡Hola, Yo voluntad mich no con fremden Federn schmücken: Es no mein Code, pero una 1:1-Umsetzung des VB-Codes. Fachliche Fehler Yo, así ellos porque drin son, natürlich übernommen!
Saludo 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 | 05.10.2008 ▲ |
|
|
|