6 out of 17 rated this helpful - Rate this topic

TIME_ZONE_INFORMATION structure

Applies to: desktop apps | Metro style apps

Specifies settings for a time zone.

Syntax

typedef struct _TIME_ZONE_INFORMATION {
  LONG       Bias;
  WCHAR      StandardName[32];
  SYSTEMTIME StandardDate;
  LONG       StandardBias;
  WCHAR      DaylightName[32];
  SYSTEMTIME DaylightDate;
  LONG       DaylightBias;
} TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION;

Members

Bias

The current bias for local time translation on this computer, in minutes. The bias is the difference, in minutes, between Coordinated Universal Time (UTC) and local time. All translations between UTC and local time are based on the following formula:

UTC = local time + bias

This member is required.

StandardName

A description for standard time. For example, "EST" could indicate Eastern Standard Time. The string will be returned unchanged by the GetTimeZoneInformation function. This string can be empty.

StandardDate

A SYSTEMTIME structure that contains a date and local time when the transition from daylight saving time to standard time occurs on this operating system. If the time zone does not support daylight saving time or if the caller needs to disable daylight saving time, the wMonth member in the SYSTEMTIME structure must be zero. If this date is specified, the DaylightDate member of this structure must also be specified. Otherwise, the system assumes the time zone data is invalid and no changes will be applied.

To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate 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.

If the wYear member is not zero, the transition date is absolute; it will only occur one time. Otherwise, it is a relative date that occurs yearly.

StandardBias

The bias value to be used during local time translations that occur during standard time. This member is ignored if a value for the StandardDate member is not supplied.

This value is added to the value of the Bias member to form the bias used during standard time. In most time zones, the value of this member is zero.

DaylightName

A description for daylight saving time. For example, "PDT" could indicate Pacific Daylight Time. The string will be returned unchanged by the GetTimeZoneInformation function. This string can be empty.

DaylightDate

A SYSTEMTIME structure that contains a date and local time when the transition from standard time to daylight saving time occurs on this operating system. If the time zone does not support daylight saving time or if the caller needs to disable daylight saving time, the wMonth member in the SYSTEMTIME structure must be zero. If this date is specified, the StandardDate member in this structure must also be specified. Otherwise, the system assumes the time zone data is invalid and no changes will be applied.

To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate 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).

If the wYear member is not zero, the transition date is absolute; it will only occur one time. Otherwise, it is a relative date that occurs yearly.

DaylightBias

The bias value to be used during local time translations that occur during daylight saving time. This member is ignored if a value for the DaylightDate member is not supplied.

This value is added to the value of the Bias member to form the bias used during daylight saving time. In most time zones, the value of this member is –60.

Remarks

Settings for each time zone are stored in the following registry key:

HKEY_LOCAL_MACHINE
   SOFTWARE
      Microsoft
         Windows NT
            CurrentVersion
               Time Zones
                  time_zone_name

Each time zone entry includes the following registry values.

Registry valueTypeDescription
DisplayREG_SZThe display name.
DltREG_SZThe description for daylight time.
MUI_DisplayREG_SZThe display name as a string of the form @path,-stringID[;comment]. For more information, see MUI.
MUI_DltREG_SZThe description for daylight time as a string of the form @path,-stringID[;comment].
MUI_StdREG_SZThe description for standard time as a string of the form @path,-stringID[;comment].
StdREG_SZThe description for standard time.
TZIREG_BINARY

The following time zone information.

typedef struct _REG_TZI_FORMAT
{
    LONG Bias;
    LONG StandardBias;
    LONG DaylightBias;
    SYSTEMTIME StandardDate;
    SYSTEMTIME DaylightDate;
} REG_TZI_FORMAT;

 

For more information about the Dynamic DST key, see DYNAMIC_TIME_ZONE_INFORMATION.

Examples

For an example, see SetTimeZoneInformation.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winbase.h (include Windows.h)

See also

DYNAMIC_TIME_ZONE_INFORMATION
GetTimeZoneInformation
SetTimeZoneInformation
SYSTEMTIME

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Bias, StandardBias, and DaylightBias
The description for Bias is a bit confusing because it implies that the Bias changes when daylight savings time goes into effect.  From what I can tell, the Bias, StandardBias, and DaylightBias remain constant throughout the year.  To convert any UTC time to local time, subtract Bias+StandardBias if the time falls within the standard range and Bias+DaylightBias if the time falls within the DST range.
Use System.TimeZone instead of calling into unmanaged code

As an alternative to calling into this unmanaged API, you might consider using the System.TimeZone managed class. See http://msdn.microsoft.com/en-us/library/system.timezone(VS.80).aspx for more information about the class and it's contents/.

C# syntax
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public struct TimeZoneInformation
{
[MarshalAs(UnmanagedType.I4)]
public int Bias;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=0x20)]
public string StandardName;
public NativeMethods.SystemTime StandardDate;
[MarshalAs(UnmanagedType.I4)]
public int StandardBias;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=0x20)]
public string DaylightName;
public NativeMethods.SystemTime DaylightDate;
[MarshalAs(UnmanagedType.I4)]
public int DaylightBias;
}
vb.net syntax
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
Public Structure TimeZoneInformation
<MarshalAs(UnmanagedType.I4)> _
Public Bias As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=&H20)> _
Public StandardName As String
Public StandardDate As SystemTime
<MarshalAs(UnmanagedType.I4)> _
Public StandardBias As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=&H20)> _
Public DaylightName As String
Public DaylightDate As SystemTime
<MarshalAs(UnmanagedType.I4)> _
Public DaylightBias As Integer
End Structure