Thanks, I also tried getFullYear() in place of getYear() and it seems to work too. Are there any known issues with using this method?
Main Topics
Browse All TopicsI am trying to implement a Javascript date function for automating copyright years at bottom of my pages. I am using a simple script I created:
<!--
YearNow = new Date();
var y = YearNow.getYear()
document.write(y);
//-->
Works fine in IE, but in Netscape I get the year 2001 displaying as 101. Is there any simple whay to correct this? or do I need to do an If statement to check browser type? How can I modify the above script to check browser type and display accordingly.
iguanadan
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here is an older script I have used in the past. I originally wrote it to resolve some of NN's and IE's Y2K and lastModified bugs.
Hope it helps.
Radar
<SCRIPT LANGUAGE="JavaScript">
<!--
monthName = new Array(12)
monthName[1] = "January"
monthName[2] = "February"
monthName[3] = "March"
monthName[4] = "April"
monthName[5] = "May"
monthName[6] = "June"
monthName[7] = "July"
monthName[8] = "August"
monthName[9] = "September"
monthName[10] = "October"
monthName[11] = "November"
monthName[12] = "December"
dayName = new Array(7)
dayName[1] = "Sunday"
dayName[2] = "Monday"
dayName[3] = "Tuesday"
dayName[4] = "Wednesday"
dayName[5] = "Thursday"
dayName[6] = "Friday"
dayName[7] = "Saturday"
var today = new Date()
var theday = today.getDay() + 1
var themonth = today.getMonth() + 1
var thedate = today.getDate()
var theyear = today.getYear()
theyear=((theyear<1000)?((
document.write("Copyright © " + " " + dayName[theday] + "," + monthName[themonth] + " " + thedate + ", " + theyear)
//-->
</SCRIPT>
Business Accounts
Answer for Membership
by: clockwatcherPosted on 2001-12-31 at 13:07:43ID: 6702987
<!--
YearNow = new Date();
var y = YearNow.getYear() < 1900;
document.write(y < 1900 ? y + 1900 : y);
//-->