<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript">
function ShowTime(){
var today=new Date();
var years=today.getFullYear();
var month=today.getMonth()+1;
var date=today.getDate();
var hours=today.getHours();
var minutes=today.getMinutes();
var seconds=today.getSeconds();
var day=today.getDay()+1;
var time="";

if(0<hours && hours<=12) {
document.getElementById("timer").innerHTML = years + " " + month + "-" + date + " " +
hours + ":" + minutes + ":" + seconds+" "+"AM"+" "+time;
}else if(hours>12 && hours<23) {
hours-=12;
document.getElementById("timer").innerHTML = years + " " + month + "-" + date + " " +
hours + ":" + minutes + ":" + seconds+" "+"PM"+" "+time;
}
}
setInterval(ShowTime,1000);

</script>
</head>
<body onload="ShowTime()">

<h1>当前时间为:<span ></span> </h1>
</body>

相关文章:

  • 2021-05-31
  • 2022-01-02
  • 2021-09-23
  • 2022-03-02
  • 2022-12-23
  • 2022-01-10
  • 2021-06-28
  • 2021-07-21
猜你喜欢
  • 2021-09-29
  • 2021-07-18
  • 2021-05-29
  • 2021-10-17
  • 2022-01-19
  • 2022-12-23
  • 2021-08-12
相关资源
相似解决方案