js求出日期
<HTML>
<HEAD>
<TITLE>时间日期篇--显示时钟</TITLE>
<meta charset="utf-8">
</HEAD>
<BODY bgcolor="#fef4d2" onload=showclock() >
<br>
<div id="clock"></div>
<script>
function changeClock()
{
var d = new Date();
var year=d.getFullYear();
var month=d.getMonth()+1;
if(month<10){
month="0"+month;
}
var day=d.getDate();
if(day<10){
day="0"+day;
}
var weekDays=new Array("星期天","星期一","星期二","星期三","星期四","星期五","星期六");
var days=d.getDay();
var hours=d.getHours();
var dn="AM";
if(hours>12){
dn="PM";
hours=hours-12;
}else if(hours==0){
hours=12;
}
var minute=d.getMinutes();
if(minute<10){
minute="0"+minute;
}
var seconds=d.getSeconds();
if(seconds<10){
seconds="0"+seconds;
}
document.getElementById("clock").innerHTML=year+"年-"+month+"月-"+day+"日 "+hours+":"+minute+":"+seconds+" "+dn+" "+ weekDays[days];
}
window.setInterval(changeClock,1000);
</script>
</BODY>
</HTML>