<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var hawhah = new Date();
var nian = hawhah.getFullYear()
var yue = hawhah.getMonth()+1
var tian = hawhah.getDate()
var shi =hawhah.getHours()
var fen =hawhah.getMinutes()
var miao = hawhah.getSeconds()
var xingqi=hawhah.getDay()
var xingqiji=0;
switch (xingqi)
{
case 0:
xingqiji="星期天"
break;
case 1:
xingqiji="星期一"
break;
case 2:
xingqiji="星期二"
break;
case 3:
xingqiji="星期三"
break;
case 4:
xingqiji="星期四"
break;
case 5:
xingqiji="星期五"
break;
case 6:
xingqiji="星期六"
break;
}
alert("现在是:"+nian+"年"+yue+"月"+tian+"日"+shi+"时"+fen+"分"+miao+"秒"+xingqiji)
</script>
</body>
</html>
刘影正 作业 -时间对象
最新推荐文章于 2018-05-18 16:02:19 发布