Redagować

Udostępnij przez


TzSpecificLocalTimeToSystemTimeEx function (timezoneapi.h)

Converts the specified local time, with dynamic daylight saving time (DST) settings, to the corresponding time in Coordinated Universal Time (UTC).

Syntax

BOOL TzSpecificLocalTimeToSystemTimeEx(
  [in, optional] const DYNAMIC_TIME_ZONE_INFORMATION *lpTimeZoneInformation,
  [in]           const SYSTEMTIME                    *lpLocalTime,
  [out]          LPSYSTEMTIME                        lpUniversalTime
);

Parameters

[in, optional] lpTimeZoneInformation

A pointer to a DYNAMIC_TIME_ZONE_INFORMATION structure that specifies the time zone and dynamic DST settings.

If lpTimeZoneInformation is NULL, the function uses the currently active time zone.

[in] lpLocalTime

A pointer to a SYSTEMTIME structure that specifies the local time to be converted. The function converts this time to the corresponding UTC time.

[out] lpUniversalTime

A pointer to a SYSTEMTIME structure that receives the UTC time.

Return value

If the function succeeds, the return value is nonzero, and the function sets the members of the SYSTEMTIME structure pointed to by lpUniversalTime to the appropriate values.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

TzSpecificLocalTimeToSystemTimeEx takes into account whether DST is in effect for the local time to be converted.

Important

The following local times, near DST transitions, can be ambiguous or invalid and might result in unexpected behavior (as there is no guaranteed "correct" result).

  • During the transition from daylight saving time to standard time, the local clock repeats. A local time within the repeated window is ambiguous because it occurs twice, once in daylight saving time and once in standard time. If such a local time is specified, this function treats it as daylight saving time and applies the daylight saving time bias.
  • During the transition from standard time to daylight saving time, the local clock jumps forward. A local time within the skipped window is invalid because it does not have a valid UTC conversion. If such a local time is specified, the function treats it as standard time and applies the standard time bias.

Applications requiring continuity or precision should avoid this function and use UTC time instead.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header timezoneapi.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll