Here you can find the source of getFileLastModified(File file)
public static String getFileLastModified(File file)
//package com.java2s; //License from project: Apache License import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getFileLastModified(File file, String format) { Date date = new Date(file.lastModified()); SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date).toString(); }//from w w w . j ava2 s . c o m public static String getFileLastModified(File file) { return getFileLastModified(file, "yyyy-MM-dd HH:mm:ss"); } }