Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Java Example Java Io Finding Last Modification Date of a file

Related Tutorials


 
 

Share on Google+Share on Google+

Finding Last Modification Date of a file

Advertisement
Learn how to find Last Modification Date of a file?

Get the Last Modification Date

    

Get the Last Modification Date

This section contains the detail about how to get the last modification date of a file. This can be done by creating instance of the file using File Class and by applying lastModified() method.

The given below example will give you a clear idea :

Example :

import java.io.File;
import java.sql.Date;

public class LastModificationDate {
public static void main(String[] args) {
File file = new File("DevFile.txt");
Long LM = file.lastModified();
Date date = new Date(LM);
System.out.println(date);
}
}

Output :

The above code will produce the following output :

2011-02-16   

Download Source Code

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 19, 2011

Related Tutorials

Discuss: Finding Last Modification Date of a file  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com