JS获得本月的第一天和最后一天
<script>
//本月第一天
function showFirstDay()
{
var Nowdate=new Date();
var MonthFirstDay=new Date(Nowdate.getYear(),Nowdate.getMonth(),1).getDate();
return MonthFirstDay;
}
//本月最后一天
function showLastDay()
{
var Nowdate=new Date();
var tmpDate=new Date(Nowdate.getYear(),Nowdate.getMonth()+1,1);
//tmpDate.setDate(tmpDate.getDate() -1);
//return new Date(Nowdate.getYear(),Nowdate.getMonth(),tmpDate.getDate());
var MonthLastDay=new Date(tmpDate-86400000).getDate();
return MonthLastDay;
}
var last = showLastDay();
var start = showFirstDay();
var date = new Date();
var a = new Array();
for(var i=start;i<=last;i++)
{
a[i-1] = (date.getMonth()+1)+"-"+i;
}
</script>