js 获取 月 的 周数

<script>


function getMonthWeek (a, b, c) {
  var date = new Date(a, parseInt(b) - 1, c), w = date.getDay(), d = date.getDate();   
  return Math.ceil((d+7-w)/7);   
};   

var last=new Date(2013,9, 0);//获取当前月最后一天时间  
var y = last.getFullYear();  
var m = last.getMonth()+1;  
var d = last.getDate();  
document.write( "周数"+ getMonthWeek(y, m, d)+' 年 ' +y+ ' 月 '+m+' 日 ' + d ); 
</script>

 

你可能感兴趣的:(js)