Skip to content

Instantly share code, notes, and snippets.

@wallace7souza
Created February 6, 2021 16:07
Show Gist options
  • Save wallace7souza/f718adf18b250b633f99656d809dad08 to your computer and use it in GitHub Desktop.
Save wallace7souza/f718adf18b250b633f99656d809dad08 to your computer and use it in GitHub Desktop.
Determine File Creation Date in Java
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