Date 与 switch的运用

<html>
<head>
<title>日期</title>
<script>
function toChinese(day){
switch(day){
case 0:
return "日";
case 1:
return "一";
case 2:
return "二";
case 3:
return "三";
case 4:
return "四";
case 5:
return "五";
case 6:
return "六";

}
}

var oDate=new Date();
var str=oDate.getFullYear()+"年"+(oDate.getMonth()+1)+"月"+oDate.getDate()+"日 星期"+toChinese(oDate.getDay());
alert("现在是:"+str);
</script>
</head>
<body>
</body>
</html>

原文地址:https://www.cnblogs.com/annie211/p/6006806.html