Export (0) Print
Expand All
3 out of 4 rated this helpful - Rate this topic

SystemTimeToTzSpecificLocalTime function

Converts a time in Coordinated Universal Time (UTC) to a specified time zone's corresponding local time.

Syntax


BOOL WINAPI SystemTimeToTzSpecificLocalTime(
  _In_opt_  LPTIME_ZONE_INFORMATION lpTimeZone,
  _In_      LPSYSTEMTIME lpUniversalTime,
  _Out_     LPSYSTEMTIME lpLocalTime
);

Parameters

lpTimeZone [in, optional]

A pointer to a TIME_ZONE_INFORMATION structure that specifies the time zone of interest.

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

lpUniversalTime [in]

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

lpLocalTime [out]

A pointer to a SYSTEMTIME structure that receives the local 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 lpLocalTime to the appropriate local time values.

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

Remarks

The SystemTimeToTzSpecificLocalTime function takes into account whether daylight saving time (DST) is in effect for the local time to which the system time is to be converted.

The SystemTimeToTzSpecificLocalTime function may calculate the local time incorrectly under the following conditions:

  • The time zone uses a different UTC offset for the old and new years.
  • The UTC time to be converted and the calculated local time are in different years.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Examples

For an example, see Retrieving the Last-Write Time.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

Winbase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

GetSystemTime
GetTimeZoneInformation
System Time
SYSTEMTIME
Time Functions
TIME_ZONE_INFORMATION
TzSpecificLocalTimeToSystemTime

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.