View Full Version : lastModified appearing as current date

09-01-2005, 09:59 PM
I am using the following script

<script language="JavaScript">
var LastUpdated = document.lastModified;
document.writeln ("Page last updated " + LastUpdated);
// -->

it shows the date properly on my local machine but when I post it on our server it shows the current date and will change the timestamp on every refresh.

Would this be happening at the server level? Or any other ideas?


09-02-2005, 08:13 PM

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'.

So basically, if it's showing the wrong date, it probably is the server sending out the wrong data in the header, yeah.

09-02-2005, 09:04 PM
Also if it's a dynamic page, with PHP etc, it'll show the current date.

09-05-2005, 01:04 AM
Also if it's a dynamic page, with PHP etc, it'll show the current date.

Yep, since the page is being generated now, the last modified would be now.