English
Forum

Timezone read ?

 
exists The Possibility, whom String the windows-Zeitzone auszulesen ?
In this case: "Amsterdam, Berlin, Bern etc..." - see Image
if so, small Help would nice

93 kB
Hochgeladen:09/22/08
Downloadcounter116
Download
 
09/22/08  
 




Gerhard
Praher
Hello Horst,

I have to a VB-example found.
Perhaps helps it to you: [...] 

love Regards
Gerhard
 
Windows XP Pro, SP3
Jetzt: XProfan 11
Was ich liebe sind 3 "F": meine Familie, meine Firma, meine Freizeit.
09/22/08  
 



@Gerhard

the are for me unfortunately "unerforschte Welten"
nevertheless thanks
 
09/22/08  
 




Gerhard
Praher
Hello Horst,

if I the example time interpret must:
interpret therefore, because I do not knows How one it in XProfan umsetzt.

there's means 2 Types-Deklarationen - i think Typdeklarationen there in XPorfan.
Then The function "GetTimeZoneInformation" from the "Kernel32.dll" hergenommen - too the might in XProfan possible his.
in the "Sub_Beispiel()" is only jener part interestingly where The Lines with "Debug.Print" begin - means with the spending the data.
In eachone this Lines finds a Formatierung the spending instead of - partly with the direct appeal of/ one function, The
The suitable values supply.
The individual functions are in the Anschluss To see (each between "Function .....()"And "End Function").

what into individual functions happens I will now not very describe, but Perhaps helps you
the Info on The Kernel32.dll already moreover.

Greeting Gerhard
 
Windows XP Pro, SP3
Jetzt: XProfan 11
Was ich liebe sind 3 "F": meine Familie, meine Firma, meine Freizeit.
09/22/08  
 




Jörg
Sellmeyer
so ought to you first helped his.
CompileMarkSeparation
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
09/22/08  
 



Runs even XP-Script (the Perform-Button)!
 
09/22/08  
 



@Grossen Thanks - Jörg

The DEF I had already, only for the "Drumherum" had I yet some Time used !
 
09/22/08  
 




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
CompileMarkSeparation
def 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
 
09/22/08  
 




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  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.760 Views

Untitledvor 0 min.
E.T.12/25/20
Uwe Lang08/08/16
Julian Schmidt08/04/11

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie