Java Files set last modified time
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.FileTime; public class Main { public static void main(String[] args) { Path path = Paths.get("Main.java"); FileTime fileTime = FileTime.fromMillis(1000L * 60 * 60 * 24 * 1000); System.out.println(fileTime); try {//w w w . jav a 2s . c o m Files.setLastModifiedTime(path, fileTime); } catch (IOException e) { e.printStackTrace(); } } }