How to show the date and time the document was last modified with JavaScript?

HTMLJavascriptProgramming Scripts

To show the last modified date with JavaScript, use the lastModified property.

Example

You can try to run the following code to display the date and time the document last modified with JavaScript −

Live Demo

<!DOCTYPE html>
<html>
   <body>
      <script>
         var date = document.lastModified;
         document.write("Last Modified: "+date);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 08:11:04
Advertisements