uses
Windows;
function FileTimeToDateTime(FileTime: TFileTime): TDateTime;
var
SystemTime: TSystemTime;
begin
FileTimeToLocalFileTime(FileTime, FileTime);
FileTimeToSystemTime(FileTime, SystemTime);
Result := SystemTimeToDateTime(SystemTime);
end;
procedure GetFileInfo(const FileName: String;
out CreationTime, ModificationTime, LastAccessTime: TDateTime);
var
FileAttributeData: TWin32FileAttributeData;
begin
ZeroMemory(@FileAttributeData, SizeOf(TWin32FileAttributeData));
GetFileAttributesEx(PAnsiChar(FileName), GetFileExInfoStandard, @FileAttributeData);
CreationTime := FileTimeToDateTime(FileAttributeData.ftCreationTime);
ModificationTime := FileTimeToDateTime(FileAttributeData.ftLastWriteTime);
LastAccessTime := FileTimeToDateTime(FileAttributeData.ftLastAccessTime);
end;
|