获取文件最后修改时间(java)

来源:互联网 发布:淘宝店铺家居名字大全 编辑:程序博客网 时间:2024/06/06 00:18
import java.text.Format;import java.text.SimpleDateFormat; File file = new File("a.txt"); long time = file.lastModified(); Date d = new Date(time); Format simpleFormat = new SimpleDateFormat("E dd MMM yyyy hh:mm:ss a"); String dateString = simpleFormat.format(d); System.err.println(file.getName()+" 最后修改时间:"+dateString);