Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Date and time of creation / modification of a file Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
13-Sep-02
Category
Files Operation
Language
Delphi All Versions
Views
52
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: William Gerbert

Date and time of creation/modification of a file

Answer:

The function FileAge() returns the date/time stamp of a file. The returned value is 
an integer number; it has to be converted to Delphi's TDateTime format (a floating 
point number) before you can use it. You can use the following code to test the 
functions involved: 


1   procedure TForm1.Button1Click(Sender: TObject);
2   var
3     File_Name: string;
4     DateTimeStamp: integer;
5     Date_Time: TDateTime;
6   begin
7     File_Name := 'c:\mydocuments\test.doc';
8     DateTimeStamp := FileAge(File_Name);
9     // FileAge returns -1 if file not found
10    if DateTimeStamp < 0 then
11      ShowMessage('File not found')
12    else
13    begin
14      // Convert to TDateTime format
15      Date_Time := FileDateToDateTime(DateTimeStamp);
16      Label1.Caption := DateToStr(Date_Time);
17      Label2.Caption := TimeToStr(Date_Time);
18    end;
19  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC