Function Reference


_Date_Time_SystemTimeToTzSpecificLocalTime

Converts a UTC time to a specified time zone's corresponding local time

#include <Date.au3>
_Date_Time_SystemTimeToTzSpecificLocalTime ( $tUTC [, $tTimeZone = 0] )

Parameters

$tUTC a $tagSYSTEMTIME structure that specifies a time in UTC or a pointer to it. The function converts this time to the specified time zone's local time.
$tTimeZone [optional] a $tagTIME_ZONE_INFORMATION structure that specifies the time zone of interest or a pointer to it.
If 0, the function uses the currently active time zone.

Return Value

Returns a $tagSYSTEMTIME structure containing the local time.

Related

$tagSYSTEMTIME, $tagTIME_ZONE_INFORMATION

Example

#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
        Local $tLocal, $tSystem

        ; 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)

        ; Convert system time to local time
        $tSystem = _Date_Time_GetSystemTime()
        $tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime($tSystem)
        MemoWrite("System time to local time .: " & _Date_Time_SystemTimeToDateTimeStr($tLocal))

        $tLocal = _Date_Time_GetLocalTime()
        $tSystem = _Date_Time_TzSpecificLocalTimeToSystemTime($tLocal)
        MemoWrite("Local time to system time .: " & _Date_Time_SystemTimeToDateTimeStr($tSystem))

        ; 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