{
File file = new File("D:/");
File[] list = file.listFiles(new FileFilter()
{
@Override
public boolean accept(File dir)
{
if (dir.isDirectory())
{
return true;
}
else
{
return false;
}
}
});
Format simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (int i = 0; i < > > {
System.out.println("fileName:"+list[i].getName());
Date d = new Date(list[i].lastModified());
String dateString = simpleFormat.format(d);
System.out.println("modifyTime:"+dateString);
}
}
你格式化日期就好了,我这只取了目录,忽略上边的就行了