Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Fecha y hora de creacion de un archivo (https://www.clubdelphi.com/foros/showthread.php?t=80461)

seoane 10-06-2006 14:33:14

Fecha y hora de creacion de un archivo
 
Código Delphi [-]
function Creacion(Filename: string): TDateTime;
var
  SearchRec: TSearchRec;
  SysTime: SYSTEMTIME;
  FileTime: TFILETIME;
begin
  Result:= 0;
  if FindFirst(PChar(FileName), faAnyFile, SearchRec) = 0 then
  begin
    FileTimeToLocalFileTime(SearchRec.FindData.ftCreationTime, FileTime);
    FileTimeToSystemTime(FileTime, SysTime);
    Result := SystemTimeToDateTime(SysTime);
    FindClose(SearchRec);
  end;
end;

Ejemplo de uso
Código Delphi [-]
  ShowMessage(DateTimeToStr(Creacion('d:\1.txt')));


La franja horaria es GMT +2. Ahora son las 00:52:40.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi