java get creation date of file

Solutions on MaxInterview for java get creation date of file by the best coders in the world

showing results for - "java get creation date of file"
Amelia
13 Apr 2018
1Path file = ...;
2BasicFileAttributes attr = Files.readAttributes(file, BasicFileAttributes.class);
3
4System.out.println("creationTime: " + attr.creationTime());
5System.out.println("lastAccessTime: " + attr.lastAccessTime());
6System.out.println("lastModifiedTime: " + attr.lastModifiedTime());
Elliott
06 Jan 2018
1Path file = ...;
2BasicFileAttributes attr = Files.readAttributes(file, BasicFileAttributes.class);
3
4System.out.println("creationTime: " + attr.creationTime());
5System.out.println("lastAccessTime: " + attr.lastAccessTime());
6System.out.println("lastModifiedTime: " + attr.lastModifiedTime());
7