home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TOOL_INC.ZIP / FILEDATE.INC < prev    next >
Encoding:
Text File  |  1988-01-29  |  809 b   |  35 lines

  1.  
  2. (*
  3.  * Return the modification date of a file as a real.
  4.  * This real will always be larger for later file dates.
  5.  *
  6.  * The returned date, if printed with writeln(date:11:4) will give
  7.  * the following format:
  8.  *        yymmdd.hhmm
  9.  *
  10.  *)
  11.  
  12. function filedate (filename:      anystring): real;
  13. var
  14.    DirInfo:     SearchRec;
  15.    Stamp:       DateTime;
  16.  
  17. begin
  18.    FindFirst(filename,$21,DirInfo);
  19.    if (DosError <> 0) then
  20.       filedate := 0
  21.    else
  22.  
  23.    begin
  24.       UnpackTime(DirInfo.time, Stamp);
  25.       filedate := int(Stamp.Year)  *10000.0 +
  26.                   int(Stamp.Month) *100.0 +
  27.                   int(Stamp.Day) +
  28.                   int(Stamp.Hour)  / 100.0 +
  29.                   int(Stamp.Min)   / 10000.0 +
  30.                   int(Stamp.Sec)   / 1000000.0;
  31.    end;
  32.  
  33. end;
  34.  
  35.