File: lastModifiedDate property

Deprecated

Avoid using this feature in new projects. This feature may be a candidate for removal from web standards or browsers.

Note: This feature is available in Web Workers.

Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.

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

js
// 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