1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

FileAge

unit
Sysutils
category
file management routines

declaration
function FileAge(const aFileName: string): Integer;

description
Returns the system time stamp of a file.

The return value can be converted to a TDateTime object using the FileDateToDateTime function.

example
var aFile : string;
    aFileDateTime : TDateTime;
    aFileOSDate : integer;
begin
 aFile : = Application.ExeName;
 aFileOSDate := FileAge(aFile);
 
 if aFileOSDate = -1 then Exit; //invalid file
 
 aFileDateTime := DateAdd(Now,1); //add a day
 
 FileSetDate(aFile, DateTimeToFileDate(aFileDateTime));  

 //Fo, our application exe file "was" modified tomorow  
end;

in real code
Your first MP3 Delphi player
See how to build a full-blown mp3 player with Delphi in just a few seconds. Even more: get the ID3 tag information from a mp3 file and change it!

see also
TDateTime, DateTimeToFileDate, FileDateToDateTime,


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.