Displaying Last Modification Date

Display information about the last time your web page was modified.

Displaying the last modified date and time of a web page is important for a web page with changing content.

A small line of JavaScript code will generate the date and time that you last saved your web page. Usually this information appears at the bottom of the web page. JavaScript uses the document.write() method to generate text, and the document.lastModified property to store the date and time when you last saved your web page. The JavaScript code must be enclosed within a starting and ending script tag.

The date and time information that appears is based on Greenwich Mean Time (GMT) and it indicates when you last saved the web page on the web server.

This is the code to place within the body tags, positioned wherever you like your Last Modified information to be displayed:

<script language=”JavaScript”>
document.write(document.lastModified);
</script>

Place the above code within the opening and closing of your web page’s body tag as shown below:

<html>
<body>

This page was last modified on:
<script language=”JavaScript”>
document.write(document.lastModified);
</script>

</body>
</html>

If you wish to customize the display of your Last Modified information, you can encapsulate the JavaScript code in any standard HTML code (apply font formatting, change text color).

 

Comments

comments

About the author

Freelancer Information Technology.