JavaScript
Last Modified Date
Back


Automatically display the date the file was last modified.

The Date() function is used to get the current date and store it in a variable called date.

Example:

Code:

<SCRIPT LANGUAGE="Javascript"> <!-- document.write("<I>Last Updated: "+ document.lastModified + "</I>"); // --> </SCRIPT>

The format of the date is browser depend. To have the date appear the same for all browsers that support javascript use the code below.

Example:

Code:

<SCRIPT LANGUAGE="Javascript"> <!-- var date = new Date(document.lastModified); document.write("<I>Last Updated:"+(date.getMonth()+1)+ "/" + date.getDate()+ "/" + date.getYear() + "</I>"); // --> </SCRIPT>


Rate this script
Excellent Acceptable Poor
Comment: