programming-examples/java/Basics/How to change(set) or Get the last modification time of a file in java .java

11 lines
332 B
Java
Raw Normal View History

2019-11-18 14:44:36 +01:00
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);
}
}