Mega Code Archive

 
Categories / Delphi / Files
 

To read a file datetime

Title: to read a file datetime Question: How to read a file age as TDateTime? Answer: If you want to receive a datetime of the specified file, then you must to call a FileAge function and convert this value using the FileDateToDateTime function into a TDateTime value: function GetFileDateTime(FileName: string): TDateTime; var intFileAge: LongInt; begin intFileAge := FileAge(FileName); if intFileAge = -1 then Result := 0 else Result := FileDateToDateTime(intFileAge) end;