直接上代码
function getWeekByDay(dayValue){ //dayValue=“2014-01-01” var day = new Date(Date.parse(dayValue.replace(/-/g, '/'))); //将日期值格式化 var today = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); //创建星期数组 console.log(today[day.getDay()]) return today[day.getDay()]; //返一个星期中的某一天,其中0为星期日 }