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:

Was this post helpful?

Comments

  1. I discovered through research a professional platform centered on leadership development: https://mbocentre.com.
    The platform brings together high-quality educational resources designed for professionals who want to grow.
    I especially appreciated the practical approach. Instead of overly academic discussions, the platform presents actionable leadership concepts.
    If you are searching for trustworthy business resources, this resource is an excellent source of knowledge. It combines modern management principles in a clear format.

Leave a Reply

Your email address will not be published. Required fields are marked *