JavaScript Last Modified Date


People like to know if you've changed the contents of a web page, so it's common to put a "Last modified" date somewhere on the page. Problem is, it's so easy to forget to change that date when you edit the page!
This script will automatically put the modified date into the file, and change the date whenever you edit the file. Like so:



   document.write("Last Updated: "+document.lastModified);

Since the JavaScript code is executed by the browser at the time the page is retrieved, the format of the date below is determined by the browser. That's usually a good thing, because dates and times are displayed differently in different parts of the world.


On the other hand - maybe you want format the outcome:

View the source of this script - it's a little more elaborate.