JRS: In article <02*************************@none.net>, seen in
news:comp.lang.javascript, Dennis Marks <de******@none.net> posted at
Sun, 2 May 2004 12:51:13 :
There seems to be a major program with the automatic display of the
last modified date. Using the javascript "document.lastModified"
sometimes returns the correct date and sometimes 1 Jan 1970 depending
the the browser.
Using SSI LAST_MODIFIED can return the last modified date, ISP system
boot date, or many others.
The only last modified date that I have been able to use with any
consistancy is the SSI flastmod command.
Is this a common problem?
ISTR that you have already been told, repeatedly, that the newsgroup FAQ
is the place to look for answers to questions which may be common. That
is one such question; and a comprehensive answer is too long to be
repeated in the newsgroup whenever someone wants to know, or twice a
week, or both.
It is often helpful to indicate one's location (or that to which
reported observations pertain), especially on date/time questions.
Since you do not do so, I had imagined you to be American. But in that
case, AIUI you would see not 1970 but 1969, the USA being
chronologically retarded. But ICBW.
However, it is useful to have the question answered here occasionally,
so that it may be checked.
I believe that the problem is multi-homed.
Either a Web server sends the Last-Modified information (which in
general will actually be Last-Uploaded) to a defined format explicitly
GMT, or it does not. I recall no proof of anything else occurring.
A browser receiving that line will generate a lastModified string, not
necessarily in a sensible format (i.e. possible Y2K error, date field
error, no zone given, ...?) but recognisably related to the upload time;
AFAIK, that is not known to fail.
A browser not receiving that line may use the current date/time, or use
the equivalent of new Date(0), hence giving Americans 1969. It could
also use a fixed string representing 1970-01-01 00:00:00, with or
without zone indicator; but I've not heard of that occurring as distinct
from the previous (in the UK, there is no necessary difference).
It would have been more sensible to leave lastModified undefined, or to
define it with an undefined value, or to set it to NaN, or to some
string such as "Not Available" or "Not Defined".
It's all rather stupid, and the underlying stupidity is at the browser-
designer level. The browser receives an unambiguous RFC2068 string,
which is directly convertible to a Date Object; but it does not
necessarily set lastModified to an equivalent string. Javascript
lastModified should have been a Date Object (or an object of a type
derived from the DO by dummying all Methods that can change the value.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.