//Get milliseconds server time (using as a virtual UTC) ServerTime is Melbourne Time var iMilliSecondsMelbourneTime = 1210380209000; var iMilliSecondsBrisbaneTime = 1210380209000; var iMilliSecondsPerthTime = 1210373009000; //Get the millisecond offset from server time tDate = new Date(); var iMelbourneMSOffset = iMilliSecondsMelbourneTime - tDate.getTime(); var iBrisbaneMSOffset = iMilliSecondsBrisbaneTime - tDate.getTime(); var iPerthMSOffset = iMilliSecondsPerthTime - tDate.getTime(); var clockTimeOutID = 0; function RefreshClock() { //Clear the current timeout ClearClockTimeout(); tDate = new Date(); iMillisecondsNow = tDate.getTime(); //Use the UTC time of the Date object as Melbourne time (AUS EST/ESuT) tDate.setTime(iMillisecondsNow + iMelbourneMSOffset); DisplayClock('ClockMelb'); //Use the UTC time of the Date object as Brisbane time (AUS EST) tDate.setTime(iMillisecondsNow + iBrisbaneMSOffset); DisplayClock('ClockBris'); //Use the UTC time of the Date object as Perth time (AUS WST) tDate.setTime(iMillisecondsNow + iPerthMSOffset); DisplayClock('ClockPert'); clockTimeOutID = setTimeout("RefreshClock()", 1000); } function DisplayClock(ElementID) { document.getElementById(ElementID).innerHTML = LeadingZero(tDate.getUTCHours()) + ":" + LeadingZero(tDate.getUTCMinutes()) + ":" + LeadingZero(tDate.getUTCSeconds()); //tDate.getUTCDate() + " " + //MonthString(tDate.getUTCMonth()) + " " + //tDate.getUTCFullYear() + "
" + } function StartClock() { clockTimeOutID = setTimeout("RefreshClock()", 10); } function ClearClockTimeout() { if(clockTimeOutID ) { clearTimeout(clockTimeOutID ); clockTimeOutID = 0; } } function MonthString(iMonth) { switch(iMonth) { case 0: return "Jan"; case 1: return "Feb"; case 2: return "Mar"; case 3: return "Apr"; case 4: return "May"; case 5: return "Jun"; case 6: return "Jul"; case 7: return "Aug"; case 8: return "Sep"; case 9: return "Oct"; case 10: return "Nov"; case 11: return "Dec"; } } function LeadingZero(iNumber) { var sNumber = ""; sNumber = "0" + iNumber.toString(); return sNumber.substr(sNumber.length - 2); } function InsertClock() { document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write(""); document.write("
Local times in Australia:
Perth
Brisbane
Melbourne
"); StartClock(); document.body.onunload += ClearClockTimeout; }