JavaScript » Document » lastModified


This property returns the date that the document was last modified.

This property returns a string relating to the date that the document was last modified, which is usually, but not always, contained in the HTTP header of a document. When this data is supplied, the server from which the document originated interogates the file for its 'last modified' date and includes this in the header information of the document. If a particular server doesn't do this, and no 'date last modified' data exists in the HTTP header, JavaScript will return a value of '0', which it interprets as 'Janurary 1, 1970 GMT'


datelastmod = document.lastModified
document.write("This document was last modified on " + datelastmod)
"This document was last modified on 10/28/97 12/06/56"

This example gets the last modified date of a document and displays it in the browser.