file date

B

Barely Audible

I've been using the following for a while to display the date of the
file its embedded in...

<script>
<!--
document.write("<center>");
document.write("<FONT COLOR=#ffffff>");
document.write("This page was last updated on "+document.lastModified);
document.write("</FONT>");
document.write("</center>");
// -->
</script>

The trouble is that its no longer displaying the file date but the
current date - anyone tell me why?

--
TTFN
Jim

There is no problem that cannot be solved by the use of large
quantities of high explosives.
 
V

VK

I've been using the following for a while to display the date of the
file its embedded in...

<script>
<!--
document.write("<center>");
document.write("<FONT COLOR=#ffffff>");
document.write("This page was last updated on "+document.lastModified);
document.write("</FONT>");
document.write("</center>");
// -->
</script>

The trouble is that its no longer displaying the file date but the
current date - anyone tell me why?

document.lastModified relies on system file time stamp reported (if
reported) by an internal system call for local files - at least on
Windows platform - or by Last-Modified HTTP header for remote files:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29
The majority of HTTP servers are configured properly and sending this
header as they should by RFC 2616

Yet for the dynamic content (CGI script, database request) Last-
Modified doesn't have an implied physical sense because physically the
generated page was just (re-)created upon you request so it's
Last_Modified just now, and this is what will be reported
automatically. For such cases the server-side script has to be
manually set to send some more relevant time stamp, say based on a
field value in a database record.

This way your problem is caused either by badly configured HTTP server
if you are accessing static HTML pages, or by missing extra logic in
your server-side script if you are accessing some dynamic content.
 
B

Barely Audible

VK said:
document.lastModified relies on system file time stamp reported (if
reported) by an internal system call for local files - at least on
Windows platform - or by Last-Modified HTTP header for remote files:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29
The majority of HTTP servers are configured properly and sending this
header as they should by RFC 2616

Yet for the dynamic content (CGI script, database request) Last-
Modified doesn't have an implied physical sense because physically the
generated page was just (re-)created upon you request so it's
Last_Modified just now, and this is what will be reported
automatically. For such cases the server-side script has to be
manually set to send some more relevant time stamp, say based on a
field value in a database record.

This way your problem is caused either by badly configured HTTP server
if you are accessing static HTML pages, or by missing extra logic in
your server-side script if you are accessing some dynamic content.

New server so its probably setup incorrectly - Thanks VK!
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
document.write("This page was last updated on "+document.lastModified);

Be aware that the format of document.lastModified is undefined and
browser-dependent. Some browsers in use give it in a deprecated
localised format (FFF) which will often be interpreted differently by
different readers. One should use
new Date(document.lastModified)
Default date-to-string is nowadays (IIRC) unambiguous but can be ugly;
use a chosen non-default conversion in public pages.


<FAQENTRY> FAQ 12.4 should use a different example; it's not sensible
for a heading to be browser-dependent.

Unfortunately, the mention of lastModified which was in the FAQ on
2005-11-05 and before is no longer present.

See <URL:http://www.merlyn.demon.co.uk/js-date2.htm#lM>.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 
V

VK

Dr said:
Be aware that the format of document.lastModified is undefined

That is not a correct statement as long as we are talking about the
documents retrieved from a Web-server which is properly configured by
RFC 2616.
document.lastModified is not an independent format but a client-side
script accessible variant of HTTP/1.1 Last-Modified content header:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29
and the latter has to send the date in HTTP-date format as indicated
in the same link. And HTTP-date:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
has "historically allowed three different formats..." and read
further. In any case it is not a particular JavaScript problem.
 
T

Thomas 'PointedEars' Lahn

VK said:
That is not a correct statement as long as we are talking about the
documents retrieved from a Web-server which is properly configured by
RFC 2616.
document.lastModified is not an independent format but a client-side
script accessible variant of HTTP/1.1 Last-Modified content header:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29
and the latter has to send the date in HTTP-date format as indicated
in the same link. And HTTP-date:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
has "historically allowed three different formats..." and read
further. In any case it is not a particular JavaScript problem.

As usual, you don't know what you are talking about. For example, in my
Internet Explorer 6 and Iceweasel (Firefox) 3.5.3, document.lastModified
yields

10/22/2009 21:49:01

which does not even remotely resemble one of

| Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
| Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
| Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format

The Web server used was "Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny3 with
Suhosin-Patch", and the relevant header was

Last-Modified: Thu, 22 Oct 2009 19:49:01 GMT

For the very same resource, I get

Thu, 22 Oct 2009 19:49:01 GMT

in Opera 10.00 and Konqueror 4.3.


PointedEars
 
V

VK

Thomas said:
For example, in my
Internet Explorer 6 and Iceweasel (Firefox) 3.5.3, document.lastModified
yields

  10/22/2009 21:49:01

which does not even remotely resemble one of

| Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
| Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
| Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format

The Web server used was "Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny3 with
Suhosin-Patch", and the relevant header was

  Last-Modified: Thu, 22 Oct 2009 19:49:01 GMT

For the very same resource, I get

  Thu, 22 Oct 2009 19:49:01 GMT

in Opera 10.00 and Konqueror 4.3.

For "Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT" (all relevant
content header values are taken straight from RFC):

Firefox: 11/15/1994 15:45:26
IE: 11/15/1994 16:45:26
Chrome: Tue, 15 Nov 1994 12:45:26 GMT
Safari: Tue, 15 Nov 1994 12:45:26 GMT
Opera: Tue, 15 Nov 1994 12:45:26 GMT

http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
"Note: HTTP requirements for the date/time stamp format apply only
to their usage within the protocol stream. Clients and servers
are
not required to use these formats for user presentation,
request
logging, etc."

HTML-date has 3 possible formats with only one that must be used and
the rest of legacy formats being only recognized. Client-side
document.lastModified default user representation may or may not
differ as allowed by the note above. In the particular and as an
instance Chrome, Safari and Opera use data "as is" while IE and
Firefox bring it to the format defined by the current OS locale
settings - the browser interface language and the page content
language do not alter this behavior, at least I didn't manage
yesterday to alter it by changing browser localization and Content-
Language header.
That btw seems allow to use an indirect way of getting an emulation of
IE's navigator.systemLanguage currently missing in Gecko. That is an
interesting practical outcome (to me at least).

document.lastModified - and here I do agree with Dr.Stockton -
intended to represent the date data in a convenient human readable
form, and this is the only thing that is guaranteed. For computer
input optimized format there are plenty of other tools server-side as
well as client-side.
If one needs to get normalized output in accordance with the HTTP/1.1
RFC then it is needed to use toUTCString on the newly created date
object and to account some toGMTString/toUTCString discrepancies with
some implementations placing "UTC" at the end (say IE) and some
placing "GMT" (say Firefox) with only "GMT" being correct by HTTP/1.1
HTML-date which is what we are normalizing to:
var lastMod = new Date(document.lastModified);
var HTML_date = lastMod.toUTCString().replace(/UTC/,'GMT');

A simple Perl script to play with if interested on the topic follows
below. As I noticed some Perl-purists around here :) I added warning
and strict modes to keep everyone if not happy then at least relaxed
though I don't normally do it for the distribution ready software.
Do not forget to 755 under Unix and to change shebang if needed.

P.S. Modern browsers are ignoring Expires content header and relaying
on their own caching algorithms. If it's needed to update after some
changes use the regular ?randomsearch way.

--------------------------------------

#!/usr/bin/perl -w

use strict 'vars';

print "Content-Type: text/html; charset=iso-8859-1\n";
print "Content-Language: en-us\n";
print "Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT\n";
print "Expires: Thu, 01 Dec 1994 16:00:00 GMT\n";

print "\n";

print <<EndOfHTML;
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>Test</title>
</head>
<body>
<h1>Test</h1>
<p>
<script type="text/javascript">
document.writeln('document.lastModified = ' +
document.lastModified + '<br>');
document.writeln('normalized form = ' +
(new Date(document.lastModified)).toUTCString().replace(/
UTC/,'GMT'));
</script>
</p>
</body>
</html>
EndOfHTML

exit(0);
 
T

Thomas 'PointedEars' Lahn

VK said:
Thomas said:
For example, in my Internet Explorer 6 and Iceweasel (Firefox) 3.5.3,
document.lastModified yields

10/22/2009 21:49:01

which does not even remotely resemble one of

| Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
| Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
| Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format

The Web server used was "Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny3 with
Suhosin-Patch", and the relevant header was

Last-Modified: Thu, 22 Oct 2009 19:49:01 GMT

For the very same resource, I get

Thu, 22 Oct 2009 19:49:01 GMT

in Opera 10.00 and Konqueror 4.3.

For "Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT" (all relevant
content header values are taken straight from RFC):

Firefox: 11/15/1994 15:45:26
IE: 11/15/1994 16:45:26
Chrome: Tue, 15 Nov 1994 12:45:26 GMT
Safari: Tue, 15 Nov 1994 12:45:26 GMT
Opera: Tue, 15 Nov 1994 12:45:26 GMT

http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
"Note: HTTP requirements for the date/time stamp format apply only
to their usage within the protocol stream. Clients and servers
are
not required to use these formats for user presentation,
request
logging, etc."
[...]

In other words:

,-<|
| [...] the format of document.lastModified is undefined and
| browser-dependent. [...]

You are pitiable.


PointedEars
 
V

VK

Thomas said:
In other words:

,-<|
| [...] the format of document.lastModified is undefined and
| browser-dependent. [...]

Noop, because the statement as it is suggests that it can be anything
up to a string like "early Friday morning of an irrelevant year" :).
Being explained as it should one can be sure that
document.lastModified string is always eatable by the Date constructor
though in this and that situation (see my first answer to OP) may
simply equal to the moment of the document's successful delivery to
the browser.
 
D

Dr J R Stockton

In comp.lang.javascript message <3e758acb-0cc2-492b-8f18-7420c49bce21@p2
0g2000vbl.googlegroups.com>, Thu, 22 Oct 2009 10:57:54, VK
That is not a correct statement as long as we are talking about the
documents retrieved from a Web-server which is properly configured by
RFC 2616.
document.lastModified is not an independent format but a client-side
script accessible variant of HTTP/1.1 Last-Modified content header:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29
and the latter has to send the date in HTTP-date format as indicated
in the same link. And HTTP-date:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
has "historically allowed three different formats..." and read
further. In any case it is not a particular JavaScript problem.

The format string document.lastModified is, to the best of my
knowledge, undefined; and it varies from browser to browser.

My IE4 gave "MM/DD/YY hh:mm:ss", in implicit GMT.
My IE6 gave "MM/DD/YYYY hh:mm:ss", in implicit LCT.
My IE7 gave "MM/DD/YYYY hh:mm:ss", in implicit LCT.
My IE8 gives "MM/DD/YYYY hh:mm:ss", in implicit LCT.
My FF3 gives "MM/DD/YYYY hh:mm:ss", in implicit LCT.
My Op9 gives "Day, DD Mon YYYY hh:mm:ss GMT".
My Sf3 gives "Day, DD Mon YYYY hh:mm:ss GMT".
Chrome gives "Day, DD Mon YYYY hh:mm:ss GMT".

It gets its value from the header Last-Modified, the transmission
format, which is unambiguously specified, and is itself completely
unambiguous. It uses four digits for the year; and it redundantly
includes day-of-week, which I expect will always be sent but ignored. It
has been specified in RFC 2068 and RFC 2616 ("HTTP/1.1"), Secs. 3.3 :
"Date/Time Formats" and Secs. 14.29 : "Last-Modified".

That is as :- Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT.

A sensible browser would copy the header exactly, and that would be a
sensible definition; but we are in the presence of Microsoft.

Read my <js-date2.htm> and <last-mod.htm>.
 
T

Thomas 'PointedEars' Lahn

VK said:
Thomas said:
In other words:

,-<|
| [...] the format of document.lastModified is undefined and
| browser-dependent. [...]

Noop, because the statement as it is suggests that it can be anything
up to a string like "early Friday morning of an irrelevant year" :).

And it can.
Being explained as it should one can be sure that document.lastModified
string is always eatable by the Date constructor though in this and that
situation

No, one evidently can not. (For example,

new Date("Sun Nov 6 08:49:37 1994")

results in "Invalid Date".) That is unsurprising, given that
document.lastModified is a proprietary property of a DOM object, and `Date'
is a standardized constructor of the ECMAScript programming language and its
conforming implementations.
(see my first answer to OP) may simply equal to the moment of the
document's successful delivery to the browser.

You don't know what you are talking, let alone what you are talking about.


PointedEars
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
Fri, 23 Oct 2009 22:39:23, Thomas 'PointedEars' Lahn
VK said:
Thomas said:
In other words:

,-<|
| [...] the format of document.lastModified is undefined and
| browser-dependent. [...]

Noop, because the statement as it is suggests that it can be anything
up to a string like "early Friday morning of an irrelevant year" :).

And it can.

There may or may not be an Official Description, globally or per
browser; but, if document.lastModified is a non-empty string, there is
a clear intention and expectation that it should be a representation,
complete or sadly partial, of the information in header Last-Modified,
if one was received.
No, one evidently can not. (For example,

new Date("Sun Nov 6 08:49:37 1994")

results in "Invalid Date".) That is unsurprising, given that
document.lastModified is a proprietary property of a DOM object, and `Date'
is a standardized constructor of the ECMAScript programming language and its
conforming implementations.

Given the intention mentioned above, it would, if true, be very
surprising. Tests in each of my five browsers showed in each case the
date being correctly recognised, give or take uncertainty about the
offset from GMT. You should report whatever browser you were using as
being in need of improvement.


Your string is not, AIUI, a full representation of Last-Modified
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
since it lacks the offset indication; and it does not match any of the
document.lastModified strings that I have recorded from versions of my
browsers.

GIYF.
 
V

VK

Dr said:
There may or may not be an Official Description, globally or per
browser; but, if document.lastModified is a non-empty string, there is
a clear intention and expectation that it should be a representation,
complete or sadly partial, of the information in header Last-Modified,
if one was received.

MSDN article on lastModified:
http://msdn.microsoft.com/en-us/library/ms533946(VS.85).aspx
"Gets the date that the page was last modified, if the page supplies
one."
Return value:
"String that receives the most recent date the page was modified, in
the form "MM/DD/YY hh:mm:ss"
I don't know how more explicit the producer have to be but there is
always a place for an improvement :)

After all
11/15/1994 15:45:26
Tue, 15 Nov 1994 12:45:26 GMT
are both in the same Nyquist–Shannon theorem equation :) :| so there
is no data in one that cannot be restored in the other and vice versa:
assuming the knowledge of the human calendar, attachment to GMT and
the equality of GMT and UTC by HTTP/1.1 - as being the constants of
the equation.
 
T

Thomas 'PointedEars' Lahn

Dr said:
Thomas 'PointedEars' Lahn posted:
VK said:
Thomas 'PointedEars' Lahn wrote:
In other words:

,-<|
| [...] the format of document.lastModified is undefined and
| browser-dependent. [...]

[...]
Being explained as it should one can be sure that document.lastModified
string is always eatable by the Date constructor though in this and that
situation

No, one evidently can not. (For example,

new Date("Sun Nov 6 08:49:37 1994")

results in "Invalid Date".) That is unsurprising, given that
document.lastModified is a proprietary property of a DOM object, and
`Date' is a standardized constructor of the ECMAScript programming
language and its conforming implementations.

Given the intention mentioned above, it would, if true, be very
surprising. Tests in each of my five browsers showed in each case the
date being correctly recognised, give or take uncertainty about the
offset from GMT. You should report whatever browser you were using as
being in need of improvement.

It is "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3) Gecko/20091010
Firefox/Iceweasel 3.5.3 (Debian-3.5.3-2) GTB5" (I have added "Firefox/" so
that UA-sniffers would recognize it properly), and I do not think it needs
improvement there. "Invalid Date" being, of course, only the string
representation of the created object.
Your string is not, AIUI, a full representation of Last-Modified
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
since it lacks the offset indication;

It is not practical evidence but verbatim the third example from the quoted
section of the HTTP/1.1 Specification; one of the three formats allowed for
this header value per that Specification (as correctly *quoted* by VK).

VK stated that document.lastModified would be a representation of the header
value, thus in one of the allowed formats, and eventually that Date() would
support whatever document.lastModified evaluated to (at least that is what I
parsed "always eatable by the Date constructor though in this and that
situation" into). The example shows that he is wrong again.
and it does not match any of the document.lastModified strings that I have
recorded from versions of my browsers.

See above.


PointedEars
 
V

VK

Thomas said:
VK stated that document.lastModified would be a representation of the header
value, thus in one of the allowed formats, and eventually that Date() would
support whatever document.lastModified evaluated to (at least that is what I
parsed "always eatable by the Date constructor though in this and that
situation" into).

Your reading is correct
The example shows that he is wrong again.

No, it only shows that you still have to learn to quote properly and
to read linked documents. I said: "HTML-date has 3 possible formats
with only one that must be used and the rest of legacy formats being
only recognized." Recognized by a conforming HTTP/1.1 server or
client, not by a scripting language on a loaded page. The linked RFC
further explains: "...MUST accept all three formats (for compatibility
with HTTP/1.0), though they MUST only generate the RFC 1123 format for
representing HTTP-date values in header fields"
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1

I hope that it is pretty much clear but don't hesitate to ask if still
in understanding troubles.
 
D

Dr J R Stockton

In comp.lang.javascript message <6b37e8ef-7415-49e4-b885-fceec9c2d027@g3
1g2000vbr.googlegroups.com>, Sat, 24 Oct 2009 10:38:08, VK
MSDN article on lastModified:
http://msdn.microsoft.com/en-us/library/ms533946(VS.85).aspx
"Gets the date that the page was last modified, if the page supplies
one."
Return value:
"String that receives the most recent date the page was modified, in
the form "MM/DD/YY hh:mm:ss"
I don't know how more explicit the producer have to be but there is
always a place for an improvement :)

That is a description for JScript. It does not apply to ECMAScript.
JScript is a partly-compliant implementation of ECMAScript, with
additions, alterations, and errors.

After all
11/15/1994 15:45:26
Tue, 15 Nov 1994 12:45:26 GMT
are both in the same Nyquist–Shannon theorem equation :) :| so there
^^^^^^^^^^^^^^^^ meaning, if any? ^^^^^^^^^^^^^^^^^^^^
is no data in one that cannot be restored in the other and vice versa:
assuming the knowledge of the human calendar, attachment to GMT and
the equality of GMT and UTC by HTTP/1.1 - as being the constants of
the equation.

Agreed that, in ECMAScript, UTC means GMT. But the first form has two
defects : there is no GMT, so it can be read as local; and it is in FFF,
so that the representation of the previous Tuesday would appear to mean
11th May 1994 (a Wednesday) in most countries.

In IE4, one gets the first form, in implicit GMT.
In IE6-8, one gets the first form. in implicit LCT.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
Sat, 24 Oct 2009 19:48:01, Thomas 'PointedEars' Lahn
Dr said:
Thomas 'PointedEars' Lahn posted:
VK wrote:
Thomas 'PointedEars' Lahn wrote:
In other words:

,-<|
| [...] the format of document.lastModified is undefined and
| browser-dependent. [...]

[...]
Being explained as it should one can be sure that document.lastModified
string is always eatable by the Date constructor though in this and that
situation

No, one evidently can not. (For example,

new Date("Sun Nov 6 08:49:37 1994")

results in "Invalid Date".) That is unsurprising, given that
document.lastModified is a proprietary property of a DOM object, and
`Date' is a standardized constructor of the ECMAScript programming
language and its conforming implementations.

Given the intention mentioned above, it would, if true, be very
surprising. Tests in each of my five browsers showed in each case the
date being correctly recognised, give or take uncertainty about the
offset from GMT. You should report whatever browser you were using as
being in need of improvement.

It is "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3) Gecko/20091010
Firefox/Iceweasel 3.5.3 (Debian-3.5.3-2) GTB5" (I have added "Firefox/" so
that UA-sniffers would recognize it properly), and I do not think it needs
improvement there. "Invalid Date" being, of course, only the string
representation of the created object.

There is a well-established world-wide convention, used not only in the
real world that a date/time without offset indication or context
indicating otherwise is a Local Civil Date/Time. That is what five
major modern browsers, including Firefox 3.0.14 and predecessors, do on
the majority OS. Doing different, therefore, is foolish.


In Windows Firefox 3.5.x, exactly how does the yellow column of the
It is not practical evidence but verbatim the third example from the quoted
section of the HTTP/1.1 Specification; one of the three formats allowed for
this header value per that Specification (as correctly *quoted* by VK).

It could be so; but it would not be sensible. Such specifications are
often forced to permit, but deprecate, existing bad practice. As, in
effect, VK has observed. The form which should be generated is as
quoted. My understanding is that there is one form allowed to be
generated, and three forms which must be accepted from elsewhere.
 
T

Thomas 'PointedEars' Lahn

Dr said:
Thomas 'PointedEars' Lahn [...] posted:
It is "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3) Gecko/20091010
Firefox/Iceweasel 3.5.3 (Debian-3.5.3-2) GTB5" (I have added "Firefox/" so
that UA-sniffers would recognize it properly), and I do not think it needs
improvement there. "Invalid Date" being, of course, only the string
representation of the created object.

There is a well-established world-wide convention, used not only in the
real world that a date/time without offset indication or context
indicating otherwise is a Local Civil Date/Time. That is what five
major modern browsers, including Firefox 3.0.14 and predecessors, do on
the majority OS. Doing different, therefore, is foolish.

Your point being?
In Windows Firefox 3.5.x, exactly how does the yellow column of the
table at <URL:http://www.merlyn.demon.co.uk/js-datex.htm#Auto> (now
longer) compare with the Firefox 3.0 column?

I do not have Windows here, as the aforementioned UA header should have
indicated. Maybe I can test it later.


PointedEars
 
V

VK

MSDN article on lastModified:
That is a description for JScript.  It does not apply to ECMAScript.
JScript is a partly-compliant implementation of ECMAScript, with
additions, alterations, and errors.

document.lastModified gets data from the browser, not from a ECMA262
3rd.ed. page, printed or electronic.
 ^^^^^^^^^^^^^^^^ meaning, if any? ^^^^^^^^^^^^^^^^^^^^
http://en.wikipedia.org/wiki/Nyquist–Shannon_sampling_theorem
yet smile should hint do not start making an actual equation. Other
words, the amount of added info noise and the amount of lost data do
not prevent us to fully restore the original informational construct
using input signals only (lastModified field in this case). Nyquist-
Shannon is very important for electronics as well as for theoretical
linguistics. Say your POD (aka modem) sent/received system is fully in
constraints of this theorem, while HTML source from server and DOM
tree in browser are not and never were (the major mistake of W3C
caused their yet another failure). An interesting OT if you like.
Agreed that, in ECMAScript, UTC means GMT.  But the first form has two
defects : there is no GMT, so it can be read as local; and it is in FFF,
so that the representation of the previous Tuesday would appear to mean
11th May 1994 (a Wednesday) in most countries.

Again, it seems like making a problem on a plain place. If one needs
to use lastModified data by script then
var lastMod = new Date(document.lastModified);

If one needs to display it later in the authentic human readable form
than:
var HTML_date = lastMod.toUTCString().replace(/UTC/,'GMT');

If one needs just to add it to the page and forget it than:
<script type="text/javascript">
document.write(
document.lastModified.
toUTCString().replace(/UTC/,'GMT')
);
</script>

It's simple as a moo caw, really.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top