1.BOOL GetFileTime( HANDLE hFile, // identifies the file
LPFILETIME lpCreationTime, // address of creation time
LPFILETIME lpLastAccessTime, // address of last access time
LPFILETIME lpLastWriteTime // address of last write time
);
HELP里有的
2、formatdatetime('yyyy-mm-dd',now)
LPFILETIME lpCreationTime, // address of creation time
LPFILETIME lpLastAccessTime, // address of last access time
LPFILETIME lpLastWriteTime // address of last write time
);
HELP里有的
2、formatdatetime('yyyy-mm-dd',now)
应怎么写?(我对api不熟)
var
hFile: THandle;
iFileDate: Integer;
begin
if Not FileExists(Edit1.Text) then
Raise Exception.Create('文件不存在!'); hFile := FileOpen(Edit1.Text, fmOpenRead);
if hFile = INVALID_HANDLE_VALUE then
Raise Exception.Create('打开文件有错'); try
iFileDate := FileGetDate(hFile);
if iFileDate <> -1 then
ShowMessage('最后一次修改时间: ' + FormatDateTime('yyyy-mm-dd hh:mm:ss', FileDateToDateTime(iFileDate)));
finally
FileClose(hFile);
end;
end;