Get the file last modified time

ReturnMethodSummary
longlastModified()Returns the time that the file denoted by this abstract pathname was last modified.

import java.io.File;
import java.util.Date;

public class Main {

  public static void main(String[] args) {
    File aFile = new File("c:/");
    System.out.println(aFile.lastModified());
    System.out.println(new Date(aFile.lastModified()));

  }
}

The output:


1288796519357
Wed Nov 03 08:01:59 PDT 2010
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.