<script type="text/javascript">

setInterval("dpTime()",1000);
 function dpTime(){
     now = new Date();
     hours = now.getHours();
     minutes = now.getMinutes();
     seconds = now.getSeconds();

     if (hours > 12){
      hours -= 12;
  ampm = "오후 ";
     }else{
      ampm = "오전 ";
     }
     if (hours < 10){
      hours = "0" + hours;
     }
     if (minutes < 10){
      minutes = "0" + minutes;
     }
     if (seconds < 10){
      seconds = "0" + seconds;
     }
document.getElementById("dpTime").innerHTML = "<b>"+ ampm + "</b>" + hours + ":" + minutes + ":" + seconds;
 }

</script>

 

그리고 시간이 들어갈 곳에

<span id="dpTime"></span>

+ Recent posts