setDate() problem
<html>
<head>
<script language="javascript">
function generate()
{
var current = new Date()
var days = new Array ('Sun','Mon','Tues','Wed','Thurs','Fri','Sat')
var months = new Array ('jan','feb','mar','apr','may','jun','jul','aug',' sept','oct','nov','dec')
for(i = 1 ; i <365 ; i++)
{
current.setDate(i);
document.write(i+". "+days[current.getDay()]+"--"+months[current.getMonth()]+" "+current.getDate()+", "+current.getYear()+"<br>")
}
}
</script>
</head>
<body onLoad=generate()>
</body>
</html>
i use this to generate 365 dates, but if you try to run this code, after the last date of the month, for example the month today is november, after november 30, the month will change to december. yup it is correct but the second date is wrong. please help me with this...
|