Java示例文件只读


Java示例文件只读

import java.io.File;

import java.text.SimpleDateFormat;



public class GetFileLastModifiedExample {

   public static void main(String[] args) {

      File f1 = new File("C:\\\\Users\\\\codingdict7\\\\Desktop\\\\abc.png");

      System.out.println("Before Format : " + f1.lastModified());

      SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");

      System.out.println("After Format : " + sdf.format(f1.lastModified()));

   }

}