String path="/mnt/sdcard/sn.odt";//我自己传到手机的一个文件,Eclipse里面用File Explorer就可以
File f=new File(path);
//Date time=new Date(f.lastModified());//两种方法都可以
if(f.exists()){//喜欢的话可以判断一下。。。
System.out.println("File Exist.");
}
long time=f.lastModified();
SimpleDateFormat formatter = new
SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String result=formatter.format(time);
result显示最后修改的时间
修改名称以后,这个值是不会变得