FileDateToDateTime
Moduł: SysUtils
function FileGetDate(Handle: Integer): Integer;
Funkcja pobiera datę ostatniej modyfikacji pliku, którego uchwyt określony jest w parametrze Handle. Data zwracana jest w postaci 32-bitowej liczby typu Integer. Do przekształcenia jej na format TDateTime może posłużyć funkcja FileDateToDateTime:
program Foo;
uses Dialogs, SysUtils;
var
Date : Integer;
S : String;
FileHandle : Integer;
begin
{ wyświetl okno służące do wskazania pliku }
if PromptForFileName(S) then
begin
FileHandle := FileOpen(S, fmOpenRead);
try
Date := FileGetDate(FileHandle);
ShowMessage(DateTimeToStr(FileDateToDateTime(Date)));
finally
FileClose(FileHandle);
end;
end;
end.
Uchwyt pliku musi być liczbą 32-bitową uzyskaną w wyniku jego otwarcia (funkcja FileOpen) lub utworzenia (FileCreate).
Zobacz też: