Here is a simple Delphi function that takes a file name as its input, and returns the date and time the file was last accessed (i.e., last access date/time stamp). For additional Delphi code for the Windows operating system, see Useful Delphi Code for the Windows Operating System.
function GetFileLastAccessDateTime(FileName: String): TDateTime; begin GetFileLastAccessDateTime := 0;
If (FileName <> '') and (FileExists(FileName) = True) then begin GetFileLastAccessDateTime := TFile.GetLastAccessTime(FileName); //TFile record is found in the IOUtils unit end; end;