By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,624 Members | 1,737 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,624 IT Pros & Developers. It's quick & easy.

javascript and netscape

P: n/a
The following script works ok for IE, but when someone views it using Netscape
the year shows as 103, is there anything that can be changed in the script to
render it Netscape friendlier please?
Thanks

<SCRIPT language=JavaScript><!--
var DayOfWeek = new
Array('Sunday','Monday','Tuesday','Wednesday','Thu rsday','Friday','Saturday');
var theDate = new Date();
var MonthName = new
Array('January','February','March','April','May',' June','July','August','Septemb
er',
'October','November','December');
document.write('<NOBR>' +
DayOfWeek[theDate.getDay()] + ' ' +
theDate.getDate() + ' ' +
MonthName[theDate.getMonth()] + ', ' +
(theDate.getYear() < 100 ? theDate.getYear() + 1900 :
theDate.getYear()) +
'</font></NOBR>');
//--></SCRIPT>
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <Ht***************@newsfep4-winn.server.ntli.net>, "Brian H供"
<no*****@this.addy.ta> writes:
The following script works ok for IE, but when someone views it using
Netscape
the year shows as 103, is there anything that can be changed in the script to
render it Netscape friendlier please?


Yes. Use getFullYear instead of getYear.
--
Randy
Jul 20 '05 #2

P: n/a
HikksNotAtHome said:
In article <Ht***************@newsfep4-winn.server.ntli.net>, "Brian H供"
<no*****@this.addy.ta> writes:
The following script works ok for IE, but when someone views it using
Netscape
the year shows as 103, is there anything that can be changed in the script to
render it Netscape friendlier please?


Yes. Use getFullYear instead of getYear.


Thank you.
Jul 20 '05 #3

P: n/a
JRS: In article <Ht***************@newsfep4-winn.server.ntli.net>, seen
in news:comp.lang.javascript, Brian H供 <no*****@this.addy.ta> posted at
Sun, 12 Oct 2003 01:44:24 :-
The following script works ok for IE, but when someone views it using Netscape
the year shows as 103, is there anything that can be changed in the script to
render it Netscape friendlier please?


Method getFullYear is available in most browsers; but all you need to do
is to change 100 to 1000 or 1e3.

When posting code, do not allow your news software to line-wrap it; that
is inconsiderate towards possible readers.

Telling your readers the current local date is rather pointless and a
waste of resources; they can discover it in many other ways.

Read the FAQ.

--
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> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.