<?php
  date_default_timezone_set('Asia/Kuala_Lumpur');
  mb_internal_encoding("UTF-8");
?>
<script>
var currenttime = "<?= date('F d, Y H:i:s')?>";
var montharray=new Array("01","02","03","04","05","06","07","08","09","10","11","12");
var weekarray=new Array("SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY");
<?php
	/*
  if($mypcsys->stype==0){
  ?>
  var vweekarray=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
  <?
  }else if($mypcsys->stype==1){
  ?>
  var vweekarray=new Array("AHAD","ISNIN","SELASA","RABU","KHAMIS","JUMAAT","SABTU");
  <?
  }
  */
?>
var serverdate=new Date(currenttime)

function padlength(what){
var output=(what.toString().length==1)? "0"+what : what
return output
}

function getPrefix(hr){
  var output="AM";
  if(hr>11){
    output="PM";
  }
  return output;
}

function getHour(hr){
  var output=hr;
  if(hr>12){
    output=hr-12;
  }
  if(hr==0){
    output=12;
  }
  return output;
}

function displaytime(){
  serverdate.setSeconds(serverdate.getSeconds()+1)
  
  var datestring= weekarray[serverdate.getDay()] + "<br>" + padlength(serverdate.getDate()) + "-" + montharray[serverdate.getMonth()] + "-" + serverdate.getFullYear(); 
  
  var timestring=getHour(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds())+" "+getPrefix(serverdate.getHours())
  
  document.getElementById("showtime").innerHTML=
	  "<table style='color: #00FFFF; ' border='0' width='100%'><tr><th width='60%'><span style='font-size:60px;'>"+timestring+"</span></th><th width='40%'><span style='font-size:35px;' >"+datestring+"</span></th></tr></table>";

}

 setInterval("displaytime()", 1000);
</script>