日期:2014-05-16  浏览次数:20342 次

设置日期无效
    dd.setFullYear(2013,8,8);
    alert(dd);return;

为什么显示出来的不是我设置的日期呢???

显示内容如下
Mon Dec 30 2013 11:29:29 GMT+0800 (CST)


我是的构想是  两个文本框  收入  2013-08-12 至 2013-09-01  点击一个按钮 
自动生成该时间日期内的所有时间 如下
2013-08-12
2013-08-13
2013-08-14
.........
2013-09-01

求高手解答

------解决方案--------------------

var d =new Date("2013,8,8").format('yyyy-MM-dd');
alert(d );



Date.prototype.format =function(format)
{
var o = {
"M+" : this.getMonth()+1, //month
"d+" : this.getDate(), //day
"h+" : this.getHours(), //hour
"m+" : this.getMinutes(), //minute
"s+" : this.getSeconds(), //second
"q+" : Math.floor((this.getMonth()+3)/3), //quarter
"S" : this.getMilliseconds() //millisecond
}
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
(this.getFullYear()+"").substr(4- RegExp.$1.length));
for(var k in o)if(new RegExp("("+ k +")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length==1? o[k] :
("00"+ o[k]).substr((""+ o[k]).length));
return format;
}