<?
  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");

  var vweekarray=new Array("星日期","星期一","星期二","星期三","星期四","星期五","星期六");

  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=padlength(serverdate.getDate()) + "-" + montharray[serverdate.getMonth()] + "-" + serverdate.getFullYear() + "&nbsp;&nbsp;<br>" + weekarray[serverdate.getDay()] + "&nbsp;<font style='font-family:Arial; font-size:35px'>"+ vweekarray[serverdate.getDay()] +"</font>"
  var datestring= "<font style='font-family:Arial; font-size:35px'>"+ vweekarray[serverdate.getDay()] +"</font>&nbsp;&nbsp;" + 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="<font style='font-size:25px;' >"+datestring+"</font><br><font style='font-size:50px;'>"+timestring+"</font>";
  document.getElementById("showtime").innerHTML="<font style='font-size:40px;' >"+datestring+"</font>";
}

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