function time() {
var today = new Date();
var hrs = today.getHours();
var min = today.getMinutes();
var secs = today.getSeconds();
var alsohrs = today.getHours();
var dayNumber = today.getDate();
var year = today.getFullYear();
var ampm="";
var zero="0";
var month = today.getMonth() +1;
var weekday = today.getDay();
var wdn = new Array(7)
wdn[0] = "Mingggu";
wdn[1] = "Senin";
wdn[2] = "Selasa";
wdn[3] = "Rabu";
wdn[4] = "Kamis";
wdn[5] = "Jumat";
wdn[6] = "Sabtu";
//Statement that puts '0's in front of single minutes or seconds.
if (min<10)
{
min=zero+min;
}
if (secs<10)
{
secs=zero+secs;
}
//Statement that eliminates Metric Time
if (hrs>12)
{
hrs=eval(hrs - 12);
}
if (hrs>=0 && hrs<1)
{
hrs=12
}
//P.M. Statement
if (alsohrs>=12 && alsohrs<24)
{
ampm="P.M.";
}
//A.M. Statement
if (alsohrs<12 && alsohrs>=0)
{
ampm="A.M.";
}
tmp='<table width="10%" class="clock"><tr>';
tmp+='<td width="113" class="time"><b>'+wdn[weekday]+',</b></td>';
tmp+= '<td width="15">'+'&nbsp;' + '</td>';
tmp+= '<td width="39"><b>'+dayNumber+'</b></td>';
tmp+= '<td width="24">'+'-'+'</td>';
tmp+= '<td width="22"><b>'+month+'</b></td>';
tmp+= '<td width="78">'+'-'+'</td>';
tmp+= '<td width="216"><b>'+year+'&nbsp;&nbsp;&nbsp;</b></td>';
tmp+= '<td width="298" class="time">'+hrs+'<span id="blinker">:</span>'+min;
tmp+= '<b>&nbsp;'+ampm+'</b></td></tr></table>'
document.getElementById("clockgoeshere").innerHTML=tmp;
clocktime=setTimeout("time()","1000");
}
function blink() {
var obj = document.getElementById("blinker");
if (obj.style.visibility == "visible") {
obj.style.visibility="hidden";
}
else {
obj.style.visibility="visible";
}
eachsecond=setTimeout("blink()","500");
}