Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
System Services
Time
Time Reference
Time Functions
 FileTimeToSystemTime function
FileTimeToSystemTime function

Applies to: desktop apps | Metro style apps

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

Syntax

BOOL WINAPI FileTimeToSystemTime(
  __in   const FILETIME *lpFileTime,
  __out  LPSYSTEMTIME lpSystemTime
);

Parameters

lpFileTime [in]

A pointer to a FILETIME structure containing the file time to be converted to system (UTC) date and time format.

This value must be less than 0x8000000000000000. Otherwise, the function fails.

lpSystemTime [out]

A pointer to a SYSTEMTIME structure to receive the converted file 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.

Examples

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

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winbase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

DosDateTimeToFileTime
File Times
FILETIME
FileTimeToDosDateTime
SYSTEMTIME
SystemTimeToFileTime
Time Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
UTC is nonsense      ElmueSoft   |   Edit   |   Show History

The description is nonsense.

This function has absolutely nothing to wethere the time is UTC or not.

When the input time is UTC the output time is also UTC.
When the input time is local time the output time is also localtime.

It depends if you called GetSystemTime() or GetLocalTime() before.
This funtion always converts 3 o'clock into 3 o'clock.
Its just another structure for the same time.

The timezone does not matter.

Tags What's this?: Add a tag
Flag as ContentBug
Rounding Behavior      Martlau1978   |   Edit   |   Show History
This function truncates towards zero, it does not round. This should be mentioned.
Tags What's this?: Add a tag
Flag as ContentBug
UTC or not?      opellegr ... Thomas Lee   |   Edit   |   Show History
It'd be nice if the function documented whether the time returned is in UTC or local time. I can deduce that since FILETIME is in UTC this should return a UTC time, but it's possible the function does a conversion. I shouldn't have to test it to find out.
C# syntax      dmex   |   Edit   |   Show History
[DllImport("Kernel32.dll", SetLastError=true)]
private static extern long FileTimeToSystemTime(ref FILETIME FileTime, ref SYSTEMTIME SystemTime);
Tags What's this?: c# (x) syntax (x) Add a tag
Flag as ContentBug
vb.net syntax      dmex   |   Edit   |   Show History
<DllImport("Kernel32.dll", SetLastError:=True)> _
Public Shared Function FileTimeToSystemTime(ByRef FileTime As FILETIME, ByRef SystemTime As SYSTEMTIME) As Long
End Function
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker