[Chapter 21] Reference: Document.lastModified
Author: David Flanagan
Date: Fri Aug 29 11:15:09 1997

#

| Chapter 21 JavaScript Reference |

# Document.lastModified Property

## Name

Document.lastModified Property---modification date of a document

## Availability

Navigator 2.0, Internet Explorer 3.0

## Synopsis

    document.lastModified

## Description

`lastModified` is a read-only string property that contains the date and time at which `document` was most recently modified. This data is derived from HTTP header data sent by the web server. The web server generally obtains the last-modified date by examining the modification date of the file itself.

Web servers are not required to provide last-modified dates for the documents they serve. When a web server does not provide a last modification date, JavaScript assumes 0, which translates to a date of January 1st, 1970, GMT. The example below shows how you can test for this case.

## Example

It is a good idea to let readers know how recent the information you provide on the Web is. You can include an automatic time stamp in your documents by placing the following script at the end of each HTML file. By doing this you do not need to update the modification time by hand each time you make a change to the file. Note that this script tests that the supplied date is a valid one before displaying it.

    <SCRIPT>
    if (Date.parse(document.lastModified) != 0)
        document.write('<P><HR><SMALL><I>Last modified: '
                       + document.lastModified
                       + '</I></SMALL>');
    </SCRIPT>

## See Also

"Document", "Document.location", "Document.referrer", "Document.title"

Document.images[] |  | Document.linkColor