Delphi Get the last modified date of the application.

function FileAge ( const FileName : string ) : Integer;

Description The FileAge function returns the last modified date and time of a file FileName.

There is no need to open or close the file - this function handles these operations silently for you.

The returned value is in a 32 bit partitioned format. Use the FiledateToDateTime function to convert into a manageable TDateTime value.

If the file date could not be found (for example, the FileName was invalid), then -1 is returned.


Example

var
   file_name:String;
   fileDate   : Integer;
begin
  file_name :=  Paramstr(0);
  fileDate  := FileAge(file_name);

// Did we get the file age OK?
  if fileDate > -1 then
    ShowMessage(file_name+' last modified date = '+
                DateToStr(FileDateToDateTime(fileDate)));

Comments