//Work out correct time to update //Grab time from this server var cridlandnow = new Date("Jun 19 2018 22:54:26"); var cridlandcorrection = (new Date() - cridlandnow); //Only update every 30 secs timeID=window.setTimeout("cridlandtimeupdate();", 1000); function cridlandtimeupdate() { var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); //Get current date cridlandnow1 = new Date(); //Apply the correction var expdate = cridlandnow1.getTime(); expdate -= cridlandcorrection; cridlandnow1.setTime(expdate); cridlandhours = cridlandnow1.getHours(); cridlandminutes = cridlandnow1.getMinutes(); if (cridlandminutes < 10) {cridlandminutes = "0" + cridlandminutes}; cridlandsecs = cridlandnow1.getSeconds(); if (cridlandsecs < 10) {cridlandsecs = "0" + cridlandsecs}; cridlandc="Current time: "+weekday[cridlandnow1.getDay()]+" "+cridlandnow1.getDate()+" "+monthname[cridlandnow1.getMonth()]+", "+cridlandhours+":"+cridlandminutes+":"+cridlandsecs+" (UK)"; document.getElementById("cridlandtime").innerHTML = cridlandc; timeID=window.setTimeout("cridlandtimeupdate();",1000); }