FileTimeToDosDateTime

  BOOL FileTimeToDosDateTime(lpft, lpwDOSDate, lpwDOSTime)    
  LPFILETIME lpft; /* address of 64-bit file time */
  LPWORD lpwDOSDate; /* address of variable for MS-DOS date */
  LPWORD lpwDOSTime; /* address of variable for MS-DOS time */

The FileTimeToDosDateTime function converts a 64-bit file time into MS-DOS date and time values.

Parameters

lpft

Pointer to the 64-bit file time (a FILETIME structure) to convert to MS-DOS date and time format.

The FILETIME structure has the following format:

typedef struct _FILETIME { /* ft */

DWORD dwLowDateTime; /* low 32 bits */

DWORD dwHighDateTime; /* high 32-bits */

} FILETIME, *PFILETIME, *LPFILETIME;

lpwDOSDate

Points to a variable that receives the MS-DOS date. The date is a 16-bit value with the following format:

Bits Contents

0–4 Day of the month (1–31)
5–8 Month (1 = January, 2 = February, etc.)
9–15 Year offset from 1980 (add 1980 to get actual year)

lpwDOSTime

Points to a variable that receives the MS-DOS time. The time is a 16-bit value with the following format:

Bits Contents

0–4 Second divided by 2
5–10 Minute (0–59)
11–15 Hour (0–23 on a 24-hour clock)

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comment

The MS-DOS date format can only represent dates between 1/1/1980 and 12/31/2107, so this conversion can fail if the input file time is outside of this range.

See Also

DosDateTimeToFileTime, SystemTimeToFileTime, FileTimeToSystemTime