<!DOCTYPE html>
<html>
<head>
<title>Date获取</title>
</head>
<body>
<div id="timeId"></div>
<script type="text/javascript">
var m_day=new Date();
document.write(m_day+'<br>');
var year=m_day.getFullYear();
document.write('<br>');
document.write(year);
document.write('<br>');
var month=m_day.getMonth();
document.write(month+1);
document.write('<br>');
var m_month=new Array(12);
m_month[0]="一月";
m_month[1]="二月";
m_month[2]="三月";
m_month[3]="四月";
m_month[4]="五月";
m_month[5]="六月";
m_month[6]="七月";
m_month[7]="八月";
m_month[8]="九月";
m_month[9]="十月";
m_month[10]="十一月";
m_month[11]="十二月";
document.write(m_month[m_day.getMonth()]);
document.write('<br>');
document.write(m_day.getDay());
document.write('<br>')
document.write(m_day.getHours()+'时');
document.write(m_day.getMinutes()+'分');
document.write(m_day.getSeconds()+'秒');
function t_time(){
var t_day=new Date();
var m_time=t_day.getHours()+'时'+t_day.getMinutes()+'分'+t_day.getSeconds()+'秒';
document.write(m_time);
}
setInterval(t_time,1000);
function timeSet(){
var r_day=new Date();
document.getElementById('timeId').innerHTML=r_day.getSeconds()+'秒'
}
setInterval('timeSet()',1000);
</script>
</body>
</html>