DelphiBasics
FileDateToDateTime
Function
Converts a file date/time format to a TDateTime value SysUtils unit
 function FileDateToDateTime(const FileDate Integer):TDateTime;
Description
The FileDateToDateTime function converts an Integer FileDate value (as obtained from FileAge for example) to a more manageable TDateTime format.
 
There are many routines in Delphi that can work on this TDateTime format.
Related commands
DateTimeToFileDateConvert a TDateTime value to a File date/time format
FileAgeGet the last modified date/time of a file without opening it
FileSetDateSet the last modified date and time of a file
 Download this web site as a Windows program.




 
Example code : Convert the last modified date of a file into a TDateTime value
var
  fileName   : string;
  fileDate   : Integer;

begin
  // Try to open the Unit1.DCU file for the current project
  fileName := 'Unit1.DCU';
  fileDate := FileAge(fileName);

  // Did we get the file age OK?
  if fileDate > -1 then
    ShowMessage(fileName+' last modified date = '+
                DateToStr(FileDateToDateTime(fileDate)));
end;
Show full unit code
  Unit1.DCU last modified date = 10/11/2002
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page