FAQ Topic - How do I format the Last-Modified date with javascript?

F

FAQ server

-----------------------------------------------------------------------
FAQ Topic - How do I format the Last-Modified date with
javascript?
-----------------------------------------------------------------------

Apparently, ` new Date() ` reads it correctly, though problems
can occur if the browser returns only two digits for the year.
In particular, time zone, field order and separators may vary.
It is also reliant on the server's clock having been correctly
set at the time of upload. See the URL
below.

http://www.merlyn.demon.co.uk/js-date2.htm#lM


--
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers. The sendings of these
daily posts are proficiently hosted by http://www.pair.com.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected].
Apparently, ` new Date() ` reads it correctly, though problems
can occur if the browser returns only two digits for the year.
In particular, time zone, field order and separators may vary.
It is also reliant on the server's clock having been correctly
set at the time of upload. See the URL
below.

If it is agreed that newer browsers return four-digit years, then I
suggest changing :
can occur if the browser returns only two digits for the year.
to :
can occur for older browsers returning only two-digit years.

Do all newer browsers consistently include offset-from-GMT indication;
and, if any do not, do they consistently give the time in one of GMT,
user's local?
 
D

Dr J R Stockton

In comp.lang.javascript message said:
Dr J R Stockton said the following on 11/9/2007 7:08 AM:
And then change it back if a new browser comes out with a bug that
returns a two-digit year?

Do you seriously think .... that even Merkin browser-writers would be
that stupid?

On the same basis you should restore the older Trim code, since RegExps
might get omitted or broken.

However, if you read what I wrote with due care, you should see that
"can occur for older browsers returning only two-digit years" refers
only to older browsers, and would remain true if new browsers appeared
with two-digit years. It would then be clear to the intelligent reader
that the new browsers would in this respect behave as the older ones.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top