为什么星期后推一天
var date = new Date;
var year = date.getFullYear();
var mon = date.getMonth()+1;
var day = date.getDate();
var weekday = new Array(7);
weekday = ["星期一","星期二","星期三","星期四","星期五","星期六","星期日"];
var now_weekday = weekday[date.getDay()];
document.write(year+"年"+mon+"月"+day+"日"+now_weekday)
;
如上代码为什么星期会后推一天呢
我按下面这么写就不会有问题
var mydate=new Date();
var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
document.write(
mydate.getFullYear()+"年"+
( mydate.getMonth()+1)+"月"+
mydate.getDate()+"日"+
mydate.getHours()+"时"+
mydate.getMinutes()+"分"+
mydate.getSeconds()+"秒"+
weekday[mydate.getDay()]+
"<br/>"+
"<br/>"
);