var start = new Date(date1replace("-","/"));
var end = new Date(date2replace("-","/"));
var diff = parseInt((end - start) / (1000606024));
<script>
function getInfo(year, month) {
var d = new Date();
// what day is first day
dsetFullYear(year, month-1, 1);
var w1 = dgetDay();
if (w1 == 0) w1 = 7;
// total day of month
dsetFullYear(year, month, 0);
var dd = dgetDate();
// first Monday
if (w1 != 1) d1 = 7 - w1 + 2;
else d1 = 1;
week_count = Mathceil((dd-d1+1)/7);
documentwrite(year + "年" + month + "月有" + week_count +"周<br/>");
for (var i = 0; i < week_count; i++) {
var monday = d1+i7;
var sunday = monday + 6;
var from = year+"/"+month+"/"+monday;
var to;
if (sunday <= dd) {
to = year+"/"+month+"/"+sunday;
} else {
dsetFullYear(year, month-1, sunday);
to = dgetFullYear()+"/"+(dgetMonth()+1)+"/"+dgetDate();
}
documentwrite("第"+(i+1)+"周 从" + from + " 到 " + to + "<br/>");
}
}
getInfo(2013,12);
</script>
以上就是关于JS如何得出两个日期之间的周数目全部的内容,包括:JS如何得出两个日期之间的周数目、js 获取某年某月有几周,以及每周的周一和周末是几号到几号、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)