SystemTimeToFileTime function (timezoneapi.h)

Converts a system time to file time format. System time is based on Coordinated Universal Time (UTC).


BOOL SystemTimeToFileTime(
  [in]  const SYSTEMTIME *lpSystemTime,
  [out] LPFILETIME       lpFileTime


[in] lpSystemTime

A pointer to a SYSTEMTIME structure that contains the system time to be converted from UTC to file time format.

The wDayOfWeek member of the SYSTEMTIME structure is ignored.

[out] lpFileTime

A pointer to a FILETIME structure to receive the converted system time.

Return value

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.


A False return value can indicate that the passed SYSTEMTIME structure represents an invalid date. Certain situations, such as the additional day added in a leap year, can result in application logic unexpectedly creating an invalid date. For more information on avoiding these issues, see leap year readiness.


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

See also






System Time

Time Functions