码迷,mamicode.com
首页 > 其他好文 > 详细

求本月有多少天?

时间:2015-04-17 18:04:26      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:

中心思想是:下个月的第0天即为本月的最后一天

 

var oDate=new Date();
 
oDate.setMonth(oDate.getDate()+1);
oDate.setDate(0);

alert(oDate.getDate());

 

求本月有多少天?

标签:

原文地址:http://www.cnblogs.com/wujidns/p/4435245.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!