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-15 12:59:38 +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);
}
}