Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
System Services
Time
Time Reference
Time Functions
 GetTimeZoneInformation function
GetTimeZoneInformation function

Applies to: desktop apps | Metro style apps

Retrieves the current time zone settings. These settings control the translations between Coordinated Universal Time (UTC) and local time.

To support boundaries for daylight saving time that change from year to year, use the GetDynamicTimeZoneInformation or GetTimeZoneInformationForYear function.

Syntax

DWORD WINAPI GetTimeZoneInformation(
  __out  LPTIME_ZONE_INFORMATION lpTimeZoneInformation
);

Parameters

lpTimeZoneInformation [out]

A pointer to a TIME_ZONE_INFORMATION structure to receive the current settings.

Return value

If the function succeeds, it returns one of the following values.

Return code/valueDescription
TIME_ZONE_ID_UNKNOWN
0

Daylight saving time is not used in the current time zone, because there are no transition dates or automatic adjustment for daylight saving time is disabled.

TIME_ZONE_ID_STANDARD
1

The system is operating in the range covered by the StandardDate member of the TIME_ZONE_INFORMATION structure.

TIME_ZONE_ID_DAYLIGHT
2

The system is operating in the range covered by the DaylightDate member of the TIME_ZONE_INFORMATION structure.

 

If the function fails for other reasons, such as an out of memory error, it returns TIME_ZONE_ID_INVALID. To get extended error information, call GetLastError.

Remarks

All translations between UTC time and local time are based on the following formula:

UTC = local time + bias

The bias is the difference, in minutes, between UTC time and local time.

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)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetDynamicTimeZoneInformation
GetTimeZoneInformationForYear
Local Time
SetTimeZoneInformation
Time Functions
TIME_ZONE_INFORMATION

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker