SetTimeZoneInformationByID (Compact 2013)

3/28/2014

This function sets the current system time zone properties with the information from the specified time zone.

Syntax

BOOL SetTimeZoneInformationByID(
    UINT nId
);

Parameters

  • nId
    [in] A valid time zone ID stored in the registry. For possible values, see Time Zone IDs.

Return Value

Nonzero indicates success. Zero (0) indicates failure. To access extended error information, call GetLastError.

Remarks

SetTimeZoneInformtionByID gets the information about the time zone specified by nID and updates the current time zone with that information. If nId is not valid, this function returns FALSE and GetLastError has value ERROR_INVALID_PARAMETER.

This function does not save the newly written data into the persistent registry. To write the data permanently, you need to make the following call: RegFlushKey(HKEY_LOCAL_MACHINE). For more information, see RegFlushKey.

All translations between Coordinated Universal Time (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.

SetTimeZoneInformationByID changes the clock to reflect the change in bias. If you change the time zone from one that does not observe Daylight Savings Time (DST) to a time zone that does (or vice versa), GetLocalTime may not immediately reflect changes. Changes will appear when the system time service properly adjusts the clock based on the new DST status.

Requirements

Header

winbase.h

Library

coredll.lib

See Also

Reference

Time Functions
GetTimeZoneInformationID