HTML DOM Document lastModified

Examples

Get the date and time the document was last modified:

let text = document.lastModified;
Try it Yourself »

Convert the lastModified property into a date object:

const date = new Date(document.lastModified);
Try it Yourself »

Description

The lastModified property returns the date and time the document was last modified.

The lastModified property is read-only.

Warning!

The "Try it Yourself" examples always return the current date/time because the document was created at run time.


Syntax

document.lastModified

Return Value

Type Description
StringThe date and time the document was last modified.

Browser Support

document.lastModified is a DOM Level 3 (2004) feature.

It is fully supported in all modern browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.