星期天的时候怎么返回这个值?
我想问下,那今天是星期天,返回的getDay()应该是七,对不对?那数组中没有7,怎么破?
我想问下,那今天是星期天,返回的getDay()应该是七,对不对?那数组中没有7,怎么破?
2016-04-11
var time = new Date();
var week = time.getDay();
var weekDay;
switch (week) {
case 0:
weekDay = "星期天";
break;
case 1:
weekDay = "星期一";
break;
case 2:
weekDay = "星期二";
break;
case 3:
weekDay = "星期三";
break;
case 4:
weekDay = "星期四";
break;
case 5:
weekDay = "星期五";
break;
case 6:
weekDay = "星期六";
break;
}
举报