# GetTimeZoneInformation Function

`Declare Function GetTimeZoneInformation Lib "kernel32.dll" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long`

GetTimeZoneInformation reads the computer's current time zone settings. Since Windows handles all of the system clock settings, there usually isn't a need for other programs to use this information. The information is put into the variable passed as lpTimeZoneInformation. The function returns 0 if an error occured, or a non-zero value if successful.

lpTimeZoneInformation
  Variable which receives the information about the system time zone.

Example:

    ' Read the name of the standard-time time zone's name
    Dim tzi As TIME_ZONE_INFORMATION
    x = GetTimeZoneInformation(tzi)
    For c = 0 To 32 ' extract string from array
      If tzi.StandardName(c) = 0 Then Exit For
      Debug.Print Chr(tzi.StandardName(c))
    Next c

Category: System Information
Back to the index.