Kambiz,
I found a problem with TFindFile and thought you would like to know.
We received files from Canada where the file date is dd/mm/yyyy. We are in the USA the file date is mm/dd/yyyy.
We copied the files to ours servers and some of the file date got messed up. I had to put a try and except in the FileTimeToDateTime to process the files.
The error I am getting without the patch is “invalid argument to date encode”.
Is there a better way to address the error?
function FileTimeToDateTime(const FileTime: TFileTime): TDateTime;
var
LocalFileTime: TFileTime;
SystemTime: TSystemTime;
begin
try // added
FileTimeToLocalFileTime(FileTime, LocalFileTime);
FileTimeToSystemTime(LocalFileTime, SystemTime);
Result := SystemTimeToDateTime(SystemTime);
except // added
Result := StrToDateTime('01/01/1980 12:00:00'); // added
end; // added
end;