Last Modified Date : Java Glossary


Last Modified Date
The Java spec says you cannot trust the value of File.lastModified to have any particular representation. It turns out it can be trusted after all, though it only became official with JDK (Java Development Kit) 1.2. Even on Win95 it returns the number of milliseconds since 1970-01-01 00:00 UTC (Coordinated Universal Time/Temps Universel Coordonné) .

With Java version 1.4 you can now set the date as well with File.setLastModified ( long timestamp )

I have written FileTimes a native class for windows that lets you get

You can examine the date with File.lastModified() and set it in Java 1.4+ with File.setLastModified()
BigDate to see how you might convert these to dates and times
but you cannot get or set the created or lastAccessed dates without without native code. I have written such native code called FileTimes to let you get/set all three dates to 1 ms precision.

Windows keeps file timestamps accurate to 100 nanoseconds with 10,000 times as much precision as Java’s 1 ms. This means if you copy a file in Java, the new file might not have the exact same timestamp as the old. When you reconstitute a zipped file, its timestamp will be reconstituted accurate only to the even 2 seconds.

This page is posted
on the web at:

Optional Replicator mirror
on local hard disk J:

Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number