Opt('MustDeclareVars', 1)
ConsoleWrite('TimeZone UTC: ' & _GetTimeZoneUTC() & @LF)
ConsoleWrite('TimeZone GMT: ' & _GetTimeZoneUTC(1) & @LF)
Func _GetTimeZoneUTC($i_GMT = 0)
Local $t_TZ, $a_Res, $i_Bias, $s_Sign, $i_Hour, $i_Min, $s_Res = 'UTC'
$t_TZ = DllStructCreate('long;byte[168]')
$a_Res = DllCall('kernel32.dll', 'dword', 'GetTimeZoneInformation', 'struct*', $t_TZ)
If (@error) Or ($a_Res[0] = -1) Then Return SetError(1, 0, '')
If $i_GMT Then $s_Res = 'GMT'
$i_Bias = DllStructGetData($t_TZ, 1)
If Not $i_Bias Then Return $s_Res
If $i_Hour > 0 Then
$s_Sign = '-'
Else
$s_Sign = '+'
EndIf
$i_Bias = Abs($i_Bias)
$i_Hour = Int($i_Bias / 60)
$i_Min = Mod($i_Bias, 60)
$s_Res &= $s_Sign & $i_Hour
If $i_Min Then $s_Res &= ':' & $i_Min
Return $s_Res
EndFunc ;==>_GetTimeZoneUTC