java.io
Class File
java.lang.Object
|
+--java.io.FilelastModified
public long lastModified()
Returns the time that the file denoted by this abstract pathname was last modified. Returns:
A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs
Throws:
SecurityException - If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to the file
Class File
java.lang.Object
|
+--java.io.FilelastModified
public long lastModified()
Returns the time that the file denoted by this abstract pathname was last modified. Returns:
A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs
Throws:
SecurityException - If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to the file
long lastModified = file.lastModified();
long now = System.currentTimeMillis();
System.out.println("没更新时间(以毫秒计):",now -lastModified);