How do I get a file last modification date?

Category: java.io, viewed: 22003 time(s).
import java.io.File;
import java.util.Date;

public class FileLastModificationDate
{
    public static void main(String[] args)
    {
        // Create an instance of file object.
        File file = new File("FileLastModificationDate.java");
        // Get the last modification information.
        Long lastModified = file.lastModified();

        // Create a new date object and pass last modified information
        // to the date object.
        Date date = new Date(lastModified);

        // We know when the last time the file was modified.
        System.out.println(date);
    }
}
Click here to lend your support to: Kode Java Org and make a donation at www.pledgie.com !

 

Uncensored Newsgroups
Download Hundreds of Complimentary Industry Resources

Get hundreds of popular Industry magazines, white papers, webinars, podcasts, and more; all available at no cost to you. With more than 600 complimentary offers, you'll find plenty of titles to suit your professional interests and needs. Click Here and Sign up today!

Java Training

Sponsored Links

Our Friends

Statistics

Locations of visitors to this page
visitor stats