Incorrect date showing in localhost
Posted by: scottmacneill (---.sip.cha.bellsouth.net)
Date: January 07, 2011 07:30PM

I am using the following code to display the current date. It displays correctly in IE localhost mode, but displays the year 2111 when accessed via localhost in both Firefox and Chrome.

The code displays the correct 2011 year from the server for all 5 major browsers. (For whatever reason, I cannot get Opera or Safari to display anything via localhost.)

Anyone have any idea as to why this would be happening? It is no big deal since it works in the live world, but I'm interested to see if anyone else has noticed the problem. Thanks.

<script type="text/JavaScript">
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"winking smiley
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December"winking smiley
</script>

Additionl code here...


<script type="text/JavaScript">
//<![CDATA[
document.write(" "+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "winking smiley
//]]>
</script>

Options: ReplyQuote


Sorry, only registered users may post in this forum.