Computer >> Computer tutorials >  >> Programming >> Javascript

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


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 −

<!DOCTYPE html>
<html>
   <body>
      <script>
         var date = document.lastModified;
         document.write("Last Modified: "+date);
      </script>
   </body>
</html>