Mastodon
Programmierung

FileTime 2 DateTime

[code lang=”delphi”]function GetModifiedDate(FileName: string): TDateTime;
var
SearchRec: TSearchRec;
ModifiedTime: TFileTime;
SystemTime: TSystemTime;
begin
Result := 0;
If FindFirst(FileName, faAnyFile, SearchRec) = 0 then
begin
ModifiedTime := SearchRec.FindData.ftLastWriteTime;
FileTimeToLocalFileTime(ModifiedTime, ModifiedTime);
FileTimeToSystemTime(ModifiedTime, SystemTime);
Result := SystemTimeToDateTime(SystemTime);
end;
FindClose(SearchRec);
end;
[/code]

[tags]Delphi, File[/tags]

0 Kommentare zu “FileTime 2 DateTime

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.