The following example demonstrates using the file.lastModified() method of the File class to obtain the last modification time of the file
/* author by w3cschool.cc Main.java */import java.io.File;import java.util.Date;public class Main { public static void main(String[] args) { File file = new File("Main.java"); Long lastModified = file.lastModified(); Date date = new Date(lastModified); System.out.println(date); }}
The output result of running the above code is:
Thu Apr 09 09:40:19 CST 2015
The above is the Java example - getting the content of the file modification time. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!