MDN self-hosted library · e01.org

File: lastModifiedDate property

File API

Open notebook · 1 cells web-api-instance-property upstream source

File API

The lastModifiedDate read-only property of the File interface returns the last modified date of the file. Files without a known last modified date return the current date.

Value

A Date object indicating the date and time at which the file was last modified. The timestamp returned by someFile.lastModifiedDate.getTime() inherits the value and precision of File.lastModified, without introducing additional inaccuracy.

Examples

// fileInput is a HTMLInputElement: <input type="file" multiple id="my-file-input">
const fileInput = document.getElementById("my-file-input");

for (const file of fileInput.files) {
  console.log(
    `${file.name} has a last modified date of ${file.lastModifiedDate}`,
  );
}

Specifications

Though present in early draft of the File API spec, this property has been removed from it and is now non-standard. Use File.lastModified instead.

Browser compatibility

See also

  • File