Supuhstar Supuhstar - 2 months ago 10
Java Question

Getting the last modified date of a file in Java

I'm making a basic file browser and want to get the last modified date of each file in a directory. How might I do this? I already have the name and type of each file (all stored in an array), but need the last modified date, too.

Answer

As in the javadocs for java.io.File:

new File("/path/to/file").lastModified()

Comments