DelphiFAQ Home Search:

Get a file's date time stamp

 

comments5 comments. Current rating: 4 stars (2 votes). Leave comments and/ or rate it.

Use this function to get a file's date and time stamp as a string:

function GetFileDate(TheFileName: string): string;
var
  f: integer;
begin
  f := FileOpen(TheFileName, 0);
  try
    Result := DateTimeToStr(FileDateToDateTime(FileGetDate(f)));
  finally
    FileClose(f);
  end;
end;

Comments:

2006-11-18, 20:15:58
anonymous from China  
The Code is just so so! really!
2007-01-14, 20:48:46
anonymous from Dergachi in Kharkivs'ka Oblast', Ukraine  
rating
Hi!
Keep up the great work. It very impressive. Thanks much!
2007-03-28, 15:39:36
anonymous  
rating
Excellent web site I will be visiting often
2007-09-20, 19:51:50
marxjo@poczta.onet.pl from Szczecin, Poland  
Its too bad this function doesnt work with system files like pagefile.sys hiberfil.sys etc
Anyone having example on how to get 3 dates from files above would do much of good if they sent it to marxjo@poczta.onet.pl :)
2009-07-28, 03:27:50
anonymous from United States  
Hi,
Can we get the file timestamp where the file is prsent in another server.

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.