//由星期的数字转换为星期的名称,date格式:2016-01-07,用"-"分割 function toWeekName(date) { var newDate = new Date(date.replace(/-/g, '/')); var weekday = new Array(7); weekday[0] = "星期日"; weekday[1] = "星期一"; weekday[2] = "星期二"; weekday[3] = "星期三"; weekday[4] = "星期四"; weekday[5] = "星期五"; weekday[6] = "星期六"; return weekday[newDate.getDay()]; }