Skip to content

Instantly share code, notes, and snippets.

@mjclemente
Created March 7, 2020 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjclemente/614a24239059180f1e03ee99b0a11c2c to your computer and use it in GitHub Desktop.
Save mjclemente/614a24239059180f1e03ee99b0a11c2c to your computer and use it in GitHub Desktop.
Get File Creation Date with Java and ColdFusion
// Sourced from https://stackoverflow.com/a/41191422
// Get file attributes using NIO
var nioPath = createObject("java", "java.nio.file.Paths").get( filePath, [] );
var nioAttributes = createObject("java", "java.nio.file.attribute.BasicFileAttributes");
var nioFiles = createObject("java", "java.nio.file.Files");
var fileAttr = nioFiles.readAttributes(nioPath, nioAttributes.getClass(), []);
writeDump( var='#parseDateTime(fileAttr.creationTime().toString())#', abort='true' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment