JavaScript获取某年某月有多少天以及第一天是星期几
程序员文章站
2022-05-04 13:52:57
function getDaysWeekady(year,month) { var date = new Date(year, month-1, 1);//月份是0-11 var days = new Date(date.getTime() - 864e5).getDate(); var weekd... ......
function getdaysweekady(year,month) { var date = new date(year, month-1, 1);//月份是0-11 var days = new date(date.gettime() - 864e5).getdate(); var weekday = date.getday(); console.log(days); console.log(weekday); }