Compartilhar via


SetTimeZoneInformation

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function sets the current time-zone parameters. These parameters control translations from UTC to local time.

Syntax

BOOL SetTimeZoneInformation(
  const TIME_ZONE_INFORMATION* lpTimeZoneInformation
);

Parameters

  • lpTimeZoneInformation
    [in] Pointer to a TIME_ZONE_INFORMATION structure that contains the time-zone parameters to set.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

SetTimeZoneInformation does not change the clock and therefore will not affect subsequent calls to GetLocalTime. SetTimeZoneInformation only affects subsequent calls to GetSystemTime. SetTimeZoneInformation 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 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.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

Time Functions
GetLocalTime
GetSystemTime
GetTimeZoneInformation
TIME_ZONE_INFORMATION

Other Resources

RegFlushKey