Created
February 6, 2021 16:07
-
-
Save wallace7souza/f718adf18b250b633f99656d809dad08 to your computer and use it in GitHub Desktop.
Determine File Creation Date in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
FileTime creationTime = (FileTime) Files.getAttribute(path, "creationTime"); | |
} catch (IOException ex) { | |
// handle exception | |
} | |
try { | |
BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class); | |
FileTime fileTime = attr.creationTime(); | |
} catch (IOException ex) { | |
// handle exception | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment