new date("2010/1/29")的返回值是2010/1/29
new date("2010","1","29")的返回值为什么是2010/2/1????问题出在哪里呢?
new date("2010","1","29")这种方式不对吗?

解决方案 »

  1.   


    alert(new Date("2010","1","29").toLocaleString());
    弹出的应该是2010.3.1号吧这里的月份是从0开始的,1就是2月份,2010年2月没29号,所以就向后推迟1天,即3月1号
      

  2.   

    alert("date=" + strtoday.getFullYear() + "/" + strtoday.getMonth() + "/" + strtoday.getDate());是2010/2/1
      

  3.   

    getMonth() 也是从0开始算的,2就是3月份。
      

  4.   

    new date("2010","1","29")这里的意思是设置为2010年2月29号。
    2010年2月没有29号所以返回下一天,即3月1号。
    2010/2/1就表示2010年3月1号