function GetFileDates(const FileName: string; out Created, Access, Modified: TDateTime): Boolean;
var
SearchRec: TSearchRec;
function Convert(const ft: TFileTime): TDateTime;
var
lt: TFileTime;
st: TSystemTime;
begin
Result := MinDouble;
if FileTimeToLocalFileTime(ft, lt) then
if FileTimeToSystemTime(lt, st) then
with st do
Result := EncodeDateTime(wYear, wMonth, wDay, wHour, wMinute, wSecond, wMilliseconds);
end;
begin
Result := False;
if FindFirst(FileName, faAnyFile, SearchRec) = 0 then
begin
Created := Convert(SearchRec.FindData.ftCreationTime);
Access := Convert(SearchRec.FindData.ftLastAccessTime);
Modified := Convert(SearchRec.FindData.ftLastWriteTime);
Result := True;
end;
FindClose(SearchRec);
end;
|