dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Java Language
Expertise: Beginner
Mar 31, 1998

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Java File date

Question:
Is there anyway with java to get a file's date?

Answer:
Unfortunately, there seems to be no platform-independent way of doing this. The lastModified() method in java.io.File returns a system dependent value that can only be used to compare the dates of files. However, the Unix and Windows95 versions of the Sun JDK represent this value as the number of seconds since 00:00 January 1, 1970. Knowing this, you can convert the value to a date using the GregorianCalendar class. But if you do this, you have to keep in mind that there is no guarantee the Sun JDK will continue to represent the time of last modification in this manner. There is also no guarantee that any other JVM will use the same representation format. In other words, you cannot use this value in a portable manner.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date