Java Examples - Get Directory Last Modified Time

Java 实例Java Example

The following example demonstrates using the file.lastModified() method of the File class to get the last modified time of the directory:

Main.java file

import java.io.File; import java.util.Date; public class Main { public static void main(String[] args) { File file = new File("C://FileIO//demo.txt"); System.out.println("Last modified time:" + new Date(file.lastModified())); } }

The output of running the above code is:

最后修改时间:Fri Apr 10 11:09:19 CST 2015

Java 实例Java Example

Other Extensions