JRS: In article <41d9f6c6$0$31857$5a62ac22@per-qv1-newsreader-
01.iinet.net.au>, dated Tue, 4 Jan 2005 11:47:42, seen in
news:comp.lang.javascript, RobG <rg***@iinet.net.auau> posted :
John Kenickney wrote: I use ASP/Javascript. I pull a date from a recordset field like this.
You should have read the newsgroup FAQ, carefully, before posting.
var theDate = new Date()
So 'theDate' contains the date of midnight on the morning of the
current date according to the user's computer (which may be set
incorrectly and almost certainly not accurately)
For me, and IIRC ECMA-262, it will contain the current instant.
Midnight does not occur on a morning; it is between p.m. and a.m. in the
American dialect, and elsewhere is 00:00 of one day and 24:00 of the
previous day.
theDate = rs.Fields.Item("date").value
Variable theDate was previously set to a Date Object, and it is now set
to (probably) a string. So (a) it was a waste of time setting it at
all; (b) if a date object, but not the current instant, were really
needed, then it is better to use new Date(0), for two reasons.
Now I want to apply the method toLocaleString().
You no longer have a Date Object; you have a String which may look like
a date.
IMHO, toLocaleString cannot normally be used for showing dates to
ordinary people on a WWW page; the result will confuse many of them.
One must construct a string that everyone will understand.
The machines in our (British) Public Library are, or at least were,
configured to American format and used mainly by Koreans.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of 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.