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.

tip

The 'try it yourself' instance always returns the current date/time because the document is created at runtime.

instance

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 supports

document.lastModified Yana cikin DOM Level 3 (2004) ɗanin.

Dukiwanci kawai yana samun ita: dukiwanci kawai yana samun ita:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support