编写代码,将当前日期按“2017-12-27 11:11 星期三”格式输出(提示:switch结构)
var date = new Date()
ymd = data.toLocaleString().split(' ')
a = ymd[0]
a = a.split('/').join('-')
b = date.getHours()+':'+date.getMinutes()
day = date.getDay()
switch(day){
case 1:
day = '星期一';
break;
case 2:
day = '星期二';
break;
case 3:
day = '星期三';
break;
case 4:
day = '星期四';
break;
case 5:
day = '星期五';
break;
case 6:
day = '星期六';
break;
case 7:
day = '星期七';
break;
}
new_day = a+' '+b+' '+day