Writing@CSU

Writing Guides

Writing for the Web

 

Adding a Time and Date Stamp to Your Pages with Javascript

I've used the following script to add the time and date on which a particular file was last saved to my pages. To use this script, simply copy the text from this page and insert it into your document at the point where you want to show the last modified date. No functions are involved. I've included text with the script to show how it might appear on your pages:

last modified:
  <script language="JavaScript">
  <!--  hide script from old browsers
    document.write(document.lastModified)
  // end hiding contents -->
  </script>

The text appears as:

last modified:
See Also
Links Page: Learn more about Javascript on the Javascript links page.

Coding Primer: View Using Javascript to learn about other useful javascripts.

Copyright © 1993-2009 Colorado State University and/or this site's authors, developers, and contributors. Some material displayed on this site is used with permission.