I am using a simple command to get the file date from a file, but keep getting the wrong date.
On my computer i looked and saw the date was 14/3/2014. But when i run the command i get 30/12/1999 no matter what file i try, it stays the same return date.
I've tried
BackupFileDate:=FileAge(S);;
originalfiledate:=FileAge(fileName);
And
BackupFileDate:=GetFileModDate(S);
originalfiledate:=GetFileModDate(Filename);
function GetFileModDate(filename : string) : TDateTime;
var
F : TSearchRec;
begin
FindFirst(filename,faAnyFile,F);
Result := F.TimeStamp;
//Result := F.Time;
FindClose(F);
end;
Both have the same result. PS: both BackupFileDate and originalfiledate are now defined as TDate, I've already tried TDateTime as-well with the same result.
I would like to get the date and time last edited of the file.