In Java 1.7, I'd read there are direct method to get last modified time of a file but I cant figure out what values should i pass to the parameters of LinkOptions. I'd appreciate the Most Simple Example. Thank You!
Path file = ...
BasicFileAttributes attrs = Files.readAttributes(file, BasicFileAttributes.class);
FileTime time = attrs.lastModifiedTime();
Java Doc BasicFileAttributes#lastModifiedTime
Or directly:
File file = new File(...);
FileTime time = Files.getLastModifiedTime(file.toPath());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With