mcmuney Posted April 23, 2010 Share Posted April 23, 2010 The year shows, "110" instead of "2010", what's wrong? <script language="JavaScript"><!-- var DayOfWeek = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); var MonthName = new Array('January','February','March','April','May','June','July','August','September', 'October','November','December'); var theDate = new Date(); document.write('<NOBR>' + DayOfWeek[theDate.getDay()] + ' ' + MonthName[theDate.getMonth()] + ' ' + theDate.getDate() + ', ' + (theDate.getYear() < 100 ? theDate.getYear() + 2000 : theDate.getYear()) + '</NOBR>'); //--></script> Quote Link to comment https://forums.phpfreaks.com/topic/199442-what-wrong-with-this-script/ Share on other sites More sharing options...
andrewgauger Posted April 23, 2010 Share Posted April 23, 2010 Replace .getYear() with .getFullYear() .getYear() is depreciated. http://www.w3schools.com/jsref/jsref_obj_date.asp Quote Link to comment https://forums.phpfreaks.com/topic/199442-what-wrong-with-this-script/#findComment-1046790 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.