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 :
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);
}
}
The above code will produce the following output :
| 2011-02-16 |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Finding Last Modification Date of a file
Post your Comment