用js:
function testDate(){
var date=new Date();
var result=date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
document.getElementById("mydate").innerHTML=result;
}
setInterval("testDate()", 1000);
在body里:
<p id="mydate"></p>
时间: 2024-11-07 22:35:03