This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

lastModifiedDate

Summary

The last modified date of the file. On getting, if user agents can make this information available, this must return a new Date object initialized to the last modified date of the file. If the last modification date and time are not known, the attribute must return the current date and time as a Date object.

Property of apis/file/Fileapis/file/File

Syntax

Note: This property is read-only.

var result = File.lastModifiedDate;

Return Value

Returns an object of type ObjectObject

Examples

This example lets you select one or more files, then reports each file’s name and last modified date/time.

<input type="file" multiple id="myfileinput"><br/>
<input type="button" value="Show file names and last modified dates" onclick="shownd()">
<p>. . .</p>
<script>
function shownd() {
  var fileinp = document.getElementById("myfileinput");
  var filelist = fileinp.files;
  alert(filelist.length);
  for (var i = 0; i < filelist.length; i++) {
    alert(filelist[i].name + " was last modified: " + filelist[i].lastModifiedDate);
  }
}
</script>

Notes

Returns the last modified date of the file in the form of a new Date object. If the browser can’t obtain file date information, null is returned.

Related specifications

W3C File API Specification
W3C Working Draft

Attributions