How to get last modified date of file in java

In this post, we will see how to get last modified date of file in java. We can use java.io.File’s lastModified() method to get last modified date. This function returns time in milliseconds(long). We can convert this to required date format using SimpleDateFormat.

Java Program:

When you run above program, you will get below output:

Add Comment