วันที่แก้ไขล่าสุดของไฟล์
package demo.file;
import java.io.File;
import java.text.SimpleDateFormat;
public class GetFileLastModifiedExample {
/**
* @param args
*/
public static void main(String[] args) {
File file = new File("C:\\users\\nopphanan7\\newfile.txt");
System.out.println("Before Format : " + file.lastModified());
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
System.out.println("After Format : " + sdf.format(file.lastModified()));
}
}
ผลลัพธ์ที่ได้คือ
Before Format : 1400321460805 After Format : 05/17/2014 17:11:00
0 comments:
Post a Comment