<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<script type="text/javascript">
time()
setInterval(time,1000)
function time(){
var oDate = new Date();
var year = oDate.getFullYear();
var month = oDate.getMonth()+1;
var day = oDate.getDate();
var week = oDate.getDay();
var hour = oDate.getHours();
var min = oDate.getMinutes();
var sex = oDate.getSeconds();
switch(week){
case 1:
week = ‘星期一‘;
break;
case 2:
week = ‘星期二‘;
break;
case 3:
week = ‘星期三‘;
break;
case 4:
week = ‘星期四‘;
break;
case 5:
week = ‘星期五‘;
break;
case 6:
week = ‘星期六‘;
break;
case 0:
week = ‘星期日‘;
break;
}
function t(t){
if(t<10){
t=‘0‘+t
}
return t;
}
document.body.innerHTML = +year+‘年‘ +month + ‘月‘ + day + ‘日‘ + week + ‘‘ + t(hour) + ‘时‘ + t(min) + ‘分‘ +t(sex) + ‘秒‘
}
</script>
</body>
</html>