1. Introduction
The setLastModified(long time()) method sets the last modified time of the file or directory.
2. Method signature
Parameters:
- time - the new last-modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
Returns
- true - true if and only if the operation succeeded; false otherwise
Throws
- SecurityException - when we do not have access to the file or directory
3. Examples
3.1. The code snippet that changes last-modified date of the file /tmp/exists.txt
The output:
4. Conclusion
In this article, we presented the method to change last-modified date of the given file in Java.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}