HTML DOM Document lastModified attribute

Definition and usage

lastModified The property returns the date and time of the last modification of the document.

lastModified The property is read-only.

Hint

The 'Try it yourself' example always returns the current date/time, because the document is created at runtime.

Example

Example 1

Get the date and time of the last modification of the document:

let text = document.lastModified;

Try it yourself

Example 2

Convert the lastModified attribute to a date object:

const date = new Date(document.lastModified);

Try it yourself

Syntax

document.lastModified

Return value

Type Description
String The date and time of the last modification of the document.

Browser support

document.lastModified ist eine DOM Level 3 (2004) Eigenschaft.

Es wird von allen Browsern unterstützt:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Unterstützt 9-11 Unterstützt Unterstützt Unterstützt Unterstützt