Retrieves the current time zone settings
#include <Date.au3>
_Date_Time_GetTimeZoneInformation ( )
In the $tagSYSTEMTIME structure, the wHour and wMinute members represent the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member indicating the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence during the month if that day of the week does not occur 5 times).
Using this notation, specify 02:00 on the first Sunday in April as follows: wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. Specify 02:00 on the last Thursday in October as follows: wHour = 2, wMonth = 10, wDayOfWeek = 4, wDay = 5.
$tagSYSTEMTIME, _Date_Time_SetTimeZoneInformation
#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
; Under Vista the Windows API "SetTimeZoneInformation" may be rejected due to system security
Global $g_idMemo
Example()
Func Example()
Local $aOld, $aNew
; Create GUI
GUICreate("Time", 400, 300)
$g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)
; Show current time zone information
$aOld = _Date_Time_GetTimeZoneInformation()
ShowTimeZoneInformation($aOld, "Current")
; Set new time zone information
If Not _Date_Time_SetTimeZoneInformation($aOld[1], "A3L CST", $aOld[3], $aOld[4], "A3L CDT", $aOld[6], $aOld[7]) Then
MsgBox($MB_SYSTEMMODAL, "Error", "System timezone cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf
; Show new time zone information
$aNew = _Date_Time_GetTimeZoneInformation()
ShowTimeZoneInformation($aNew, "New")
; Reset original time zone information
_Date_Time_SetTimeZoneInformation($aOld[1], $aOld[2], $aOld[3], $aOld[4], $aOld[5], $aOld[6], $aOld[7])
; Show current time zone information
$aOld = _Date_Time_GetTimeZoneInformation()
ShowTimeZoneInformation($aOld, "Reset")
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>Example
; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; Show time zone information
Func ShowTimeZoneInformation(ByRef $aInfo, $sComment)
MemoWrite("******************* " & $sComment & " *******************")
MemoWrite("Result ............: " & $aInfo[0])
MemoWrite("Current bias ......: " & $aInfo[1])
MemoWrite("Standard name .....: " & $aInfo[2])
MemoWrite("Standard date/time : " & _Date_Time_SystemTimeToDateTimeStr($aInfo[3]))
MemoWrite("Standard bias......: " & $aInfo[4])
MemoWrite("Daylight name .....: " & $aInfo[5])
MemoWrite("Daylight date/time : " & _Date_Time_SystemTimeToDateTimeStr($aInfo[6]))
MemoWrite("Daylight bias......: " & $aInfo[7])
EndFunc ;==>ShowTimeZoneInformation