Back

The FileDateToDateTime function converts a DOS date-time value to TDateTime value.
The FileAge function returns the date-and-time stamp of a specified file.
The DateToStr converts a TDateTime value to a string.

Example:

This is a way to display a files date(age).
We will use a OpenDialog component to find the file we want to find the age of.
Label1 will show the result of this code.

procedure TForm1.Button3Click(Sender: TObject);
var TheFilesAge : Integer;
begin
  if OpenDialog1.Execute then
   begin
     TheFilesAge := FileAge(OpenDialog1.FileName);
     Label1.Caption :=  (DateToStr(FileDateToDateTime(TheFilesAge)));
   end;
end;


Back