The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes File attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "File attributes" Watch "File attributes" New topic

File attributes

shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
Is it possible to get the created on date/time using Java. In File class we have an API lastModified() but how to get createdon date/time.
Junilu Lacar

Joined: Feb 26, 2001
Posts: 4447

I don't know of any OS file systems that keep the last modified and creation timestamps separately. You only see the last modified timestamp which is why the API only has lastModified(). If the file happens to be a new one, the last modified timestamp would be the creation timestamp as well.
To preserve the creation timestamp, that information would have to be embedded into the document itself, similar to what MS Word does with its .doc files. But that is application specific behavior and I don't think that's something that you'll find being supported in the standard Java API anytime soon, if ever.

Junilu - [How to Ask Questions] [How to Answer Questions]
shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
In windows, we can see the created,modified,accessed timestamps of any file by viewing its properties. I was mentioning that... Is it possible to get these timestamps ??
Consider Paul's rocket mass heater.
subject: File attributes
Similar Threads
how to get the created time of a file
YYYYMMDD HH:MM:SS.uuuuuu how to convert this type of date to datetime
Output File Properties
File Attributes
File Modification time..