Syntax

JSV_getDocumentLastModified()

Prototype

n/a

Returns

A string representing the date that a document was last modified.

Parameters

The JSV_getDocumentLastModified function does not take an argument.

Remarks

The lastModified property is derived from the HTTP header data sent by the Web server. Servers generally obtain this date by examining the file's modification date.

The last modified date is not a required portion of the header, and some servers do not supply it. If the server does not return the last modified information, JavaScript receives a 0, which it displays as January 1, 1970 GMT.

A problem can be encountered when using Date with document.lastModified:

var modDate = new Date(document.lastModified);

For example, in Netscape 4.08 we get the following:

document.lastModified: 01/19/00 08:35:19
lastModified applying new Date(document.lastModified):
Fri Jan 19 08:35:19 GMT-0600 (Central Standard Time) 1900

In Netscape 3.04 we get the following:

document.lastModified: 01/19/00 08:35:42
lastModified applying new Date(document.lastModified):
Fri Jan 19 08:35:42 Central Standard Time 1900

In IE5 we get the following:

document.lastModified: 01/19/2000 08:33:28
lastModified applying new Date(document.lastModified):
Wed Jan 19 08:33:28 CST 2000

Dependencies

JSV_formatDate

Example

The following lines of code

document.write( JSV_getDocumentLastModified() );
var dmd = new Date(JSV_getDocumentLastModified());
document.write( dmd );

produce