導航:首頁 > 文件教程 > delphi設置文件時間

delphi設置文件時間

發布時間:2023-06-29 01:42:17

⑴ delphi獲取當前日期,包括年份月份星期時間。

1、打開Delphi7集成開發環境,在Diaglog面板,向默認工程的Form1窗體放一個Opendiag1控制項。

⑵ delphi idftp 獲取修改時間

獲取文件的修改時間你看看下面的方法能不能用:
Windows 提供一個函數 GetFileTime 做此項操作,在 Delphi 中可方便地調用,示例如下:

procere GetFileLastAccessTime(FileName: PChar);
var
CreateFT, LastAccessFT, LastWriteFT: TFileTime;
ST: TSystemTime;
F: Integer;
begin
{ 首先要用Windows的標准API函數以讀方式打開文件 }
F := CreateFile(FileName, GENERIC_READ, 0, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if F=INVALID_HANDLE_VALUE then
begin
ShowMessage(』Can not open file!』);
Exit;
end;
{ 取文件時間 }
if GetFileTime(F, @CreateFT, @LastAccessFT, @LastWriteFT) then
begin
{ 轉換為系統時間並顯示 }
FileTimeToSystemTime(LastAccessFT, ST);
Label1.Caption := Format(』%d-%d-%d, %d:%d:%d』,
[ST.wYear, ST.wMonth, ST.wDay, ST.wHour, ST.wMinute,ST.wSecond]);
end;
CloseHandle(F); { 記住關閉文件 }
end;

⑶ delphi中如何抓取文件夾的修改日期

如下代碼
uses
comctrls, ShellAPI, commctrl;

{...}

const
FL_FOLDER = 1;
FL_FILE = FL_FOLDER + 1;
{ 文件日期類型 }
FD_CREATED = 1;
FD_ACCESSED = FD_CREATED + 1;
FD_MODIFIED = FD_ACCESSED + 1;

type
FileInfoPtr = ^FileInfoRec;
FileInfoRec = record
fName : string;
typ : byte;
Modified : TDateTime;
end;

function GetFileTimes(FileName : ShortString; typ : byte; var fDate : TDateTime) : Boolean;
var
fHandle : Integer;
fTimeC,
fTimeA,
fTimeM : TFileTime;
lTime : TFileTime;
sTime : TSystemTime;
begin { GetFileTimes }
fHandle := FileOpen(FileName, fmShareDenyNone);
fDate := 0.0;
result := (fHandle >= 0);
if result
then begin GetFileTime(fHandle, @fTimeC, @fTimeA, @fTimeM);
FileClose(fHandle);
case typ of
FD_CREATED : FileTimeToLocalFileTime(fTimeC, lTime);
FD_ACCESSED : FileTimeToLocalFileTime(fTimeA, lTime);
FD_MODIFIED : FileTimeToLocalFileTime(fTimeM, lTime);
end;
if FileTimeToSystemTime(lTime, sTime)
then fDate := EncodeDate(sTime.wYear, sTime.wMonth, sTime.wDay) + EncodeTime(sTime.wHour, sTime.wMinute, sTime.wSecond, sTime.wMilliSeconds);
end;
end; { of GetFileTimes }

⑷ 用delphi如何修改FTP伺服器上文件的修改時間

自己寫一個 FTP SERVER, 上傳文件的時候把時間也帶上

閱讀全文

與delphi設置文件時間相關的資料

熱點內容
ps2021暫存檔文件手動清理 瀏覽:459
fdt表中的長文件名 瀏覽:508
mysql管理員默認密碼 瀏覽:359
越獄ios8直接刪系統文件 瀏覽:490
文件櫃的傾斜度是多少 瀏覽:115
蘋果耳機切換不了 瀏覽:968
有什麼小說網站可以看所有小說 瀏覽:661
蘋果雲盤文件怎麼存在 瀏覽:466
紅米手機裡面的txt文件 瀏覽:360
華為pad攝像頭在哪個文件夾 瀏覽:147
手機版編程貓如何復制角色 瀏覽:599
動漫圖片的文件格式 瀏覽:560
黑衣緊身美女跳小蘋果 瀏覽:670
無法收縮資料庫 瀏覽:216
java中獲取二維數組的長度 瀏覽:510
手機裡面的數據線怎麼接 瀏覽:491
微信轉帳是紅包嗎 瀏覽:748
如何學會函數編程 瀏覽:985
js賦值高度 瀏覽:940
錄像機登錄密碼 瀏覽:94

友情鏈接