Sets the current time zone settings. These settings control translations from Coordinated Universal Time (UTC) to local time.
To support boundaries for daylight saving time that change from year to year, use the SetDynamicTimeZoneInformation function.
BOOL SetTimeZoneInformation( const TIME_ZONE_INFORMATION *lpTimeZoneInformation );
A pointer to a TIME_ZONE_INFORMATION structure that contains the new settings.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
An application must have the SE_TIME_ZONE_NAME privilege for this function to succeed. This privilege is disabled by default. Use the AdjustTokenPrivileges function to enable the privilege before calling SetTimeZoneInformation, and then to disable the privilege after the SetTimeZoneInformation call. For more information, see Running with Special Privileges.
Windows Server 2003 and Windows XP/2000: The application must have the SE_SYSTEMTIME_NAME privilege.
Specific to Windows 7 and Windows 8, call SetDynamicTimeZoneInformation to set system time zone information instead of SetTimeZoneInformation. support provided for dynamic daylight savings time in. In a scenario where an application calls SetTimeZoneInformation instead, dynamic daylight saving time support is disabled for the calling application.
To inform Explorer that the time zone has changed, send the WM_SETTINGCHANGE message.
All translations between UTC and local time are based on the following formula:
UTC = local time + bias
The bias is the difference, in minutes, between UTC and local time.
The following example displays the current time zone, then adjusts the time zone one zone west. The old and new time zone names are displayed. You can also verify the changes using Date and Time in Control Panel. The new name is displayed on the Date&Time tab as the Current Time Zone. The new time zone is displayed in the drop-down list on the Time Zone tab. To undo these changes, simply choose your old time zone from the drop-down list.
#define UNICODE 1 #define _UNICODE 1
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||timezoneapi.h (include Windows.h)|