We would like to know how to get last modified time in milliseconds since midnight on 1st January 1970 GMT.
import java.io.File; import java.util.Date; public class MainClass { public static void main(String[] args) { // Create an object that is a directory File myDir = new File("C:/Java_Dev"); System.out.println(new Date(myDir.lastModified())); } }
The code above generates the following result.