得到某年某月有多少天

  function   mm(y,m)  
  {  
  return   (new   Date(y,m+1,0)).getDate();  
  }  
   
  alert("2001年二月的天数是:"+mm(2001,1));//

 

document.write(new Date(2009, 4, 1)); //2009年5月的第1天(1月的值是0),2009年5月1日
 document.write(new Date(2009, 5, 0)); //2009年6月的第0天,也就是2009年5月的最后一天

 

posted @ 2009-12-01 17:48  0707  阅读(130)  评论(0编辑  收藏  举报