Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get OS timestamp

Status
Not open for further replies.

lloydie2

Programmer
Apr 21, 2003
75
GB
How can I get the OS timestamp for now as an integer?
I want to compare the a file using 'fileage()' against 'now'
 
You really should check the help file before posting here with a question that is already answered:

Help file:
Call FileAge to obtain the OS timestamp of the file specified by FileName. The return value can be converted to a TDateTime object using the FileDateToDateTime function. The return value is -1 if the file does not exist.

But I don't quite understand why you would want to compare the file age with Now(). Unless time zones are involved, wouldn't every file be older than Now()?

 
I know how to get the OS timestamp of a file. I believe that 'fileage' is based on that of the OS timestamp. I wish to compare the difference between a file timpstamp and the current time. ie the timestamp of a file and the timestamp now.
 
I don't understand your request.

1. I have a file with a file date of 2/9/2005 7:13:12 AM
2. The FileAge() function gives 843,659,686
3. The FileDateToDateTime() function gives 38392.3008333
4. 38392.3008333 when interpreted as a date is 2/9/2005 7:13:12 AM

What more is needed?

 
Zathras,
Maybe I was not making myself clear, but you have pointed me in the right direction. What I was after was 'DateTimeToFileDate(now)'

Thanks
 

Glad you got it sorted. But I'm still curious how you can make files in the future (else why are you checking against the current date and time).

Can you get tomorrow's Wall Stret Journal, too?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top