471,092 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,092 software developers and data experts.

javascript and netscape

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
3 1280
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
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
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.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.