Android Get File Last Modified Date

To get a files last modified date in Android use the .lastModified() function. You can do like this:

File file = new File(filePath);
Date lastModDate = new Date(file.lastModified());
Log.i("TAG", "File last modified "+ lastModDate.toString());

This will log the last modified date for your given file in the filePath.

Posted in Android, Tips and Tricks Tagged with: , ,