日期:2014-05-17 浏览次数:20502 次
function getStartDateByWeek(year, week) { var startDate = new Date(); startDate.setFullYear(year, 0, 1); //变态的js月份从0开始 var dayOfWeek = startDate.getDay(); var count = 0; var weekCount = 1; if (weekCount === week) { return startDate; } else { while (weekCount !== week) { startDate.setDate(startDate.getDate() + 7); weekCount++; } while (dayOfWeek > 0) { startDate.setDate(startDate.getDate() - 1); dayOfWeek = startDate.getDay(); } } return startDate; }