HTML DOM lastModified Property

The DOM lastModified property in HTML is used to return the date and time of the current document that was last modified. This property is read-only. This property returns a string that contains the date and time when the document was last modified. 

Syntax:

document.lastModified

Example: In this example, we will use the lastModified property

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        DOM lastModified Property
    </title>
</head>
 
<body style="text-align:center">
    <h1 style="color:green;">
        w3wiki
    </h1>
    <h2>
        DOM lastModified Property
    </h2>
    <button onclick="Beginner()">
        Submit
    </button>
    <p id="sudo"></p>
    <script>
        /* Function to use lastModified property */
        function Beginner() {
            let x = document.lastModified;
            document.getElementById("sudo").innerHTML = x;
        }
    </script>
</body>
 
</html>


Output:

 

Supported Browsers: The browser supported by DOM lastModified Property are listed below:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 4
  • Firefox 1
  • Opera 12.1
  • Safari 1

Contact Us