Android: How to get a file's creation date?

后端 未结 6 1736
孤独总比滥情好
孤独总比滥情好 2020-11-28 05:38

This is my code:

File TempFiles = new File(Tempfilepath);
if (TempFiles.exists()) {
    String[] child = TempFiles.list();
    for (int i = 0; i < child.l         


        
6条回答
  •  甜味超标
    2020-11-28 05:58

    The file creation date is not an available, but you can get the last-modified date:

    File file = new File(filePath);
    Date lastModDate = new Date(file.lastModified());
    
    System.out.println("File last modified @ : "+ lastModDate.toString());
    

提交回复
热议问题