﻿function WorldClock(){
now=new Date();
hr=now.getHours();
min=now.getMinutes();
sec=now.getSeconds();
off=now.getTimezoneOffset()/60;
hr=hr+parseInt(off)+2;

save=0;
month=now.getMonth()+1;
day=now.getDate();
if (day>=25 && month==3) save=1;
if (day<25 && month>3) save=1;
if (day>=28 && month==10) save=0;
if (day<28 && month>10) save=0;
hr=hr+save;

if (hr < 0) hr+=24;
if (hr > 23) hr-=24;
ampm = (hr > 11)?"PM":"AM";

if (hr == 0) hr=12;
if (hr > 12) hr=hr-12;
if (hr < 10) hr="0"+hr;
if (min < 10) min="0"+min;
if (sec < 10) sec="0"+sec;

finaltime = hr + ":" + min + " " + ampm;

if (document.all)
worldclock.innerHTML=finaltime
else if (document.getElementById)
document.getElementById("worldclock").innerHTML=finaltime

setTimeout('WorldClock()',1000);
}