»
EnglishFrenchVietnamese

Print - Multi-Display Clock script - JavaScriptBank.com

Full version: jsB@nk » Time » Clock » Multi-Display Clock script
URL: http://www.javascriptbank.com/multi-display-clock-script.html

Multi-Display Clock script © JavaScriptBank.comThis is a multi-display clock with local time, UTC time, local/UTC decimal time, UMT, hex time, Swatch Internet Time, New Earth Time, and a countdown clock. IE only.

Full version: jsB@nk » Time » Clock » Multi-Display Clock script
URL: http://www.javascriptbank.com/multi-display-clock-script.html



CSS
<style type="text/css"><!--input {  border: 0;  background-color: #fff;color: #000;}--></style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script type="text/javascript"><!--/*Created by: Ryan Provost :: http://rynprov.100free.com */function clock() {  if (!document.layers && !document.all) return;  var hex = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");  var ticktock = new Date();  var month = ticktock.getMonth()+1;  var date = ticktock.getDate();  var day = ticktock.getDay();  var year = ticktock.getFullYear();  var utime = ticktock.getTime();  var hours = ticktock.getHours();  var minutes = ticktock.getMinutes();  var seconds = ticktock.getSeconds();  var GMTmonth = ticktock.getUTCMonth()+1;  var GMTdate = ticktock.getUTCDate();  var GMTday = ticktock.getUTCDay();  var GMTyear = ticktock.getUTCFullYear();  var GMThours = ticktock.getUTCHours();  var GMTminutes = ticktock.getUTCMinutes();  var GMTseconds = ticktock.getUTCSeconds();  var milliseconds = (utime*1000).toString().substring(10,13);  var apm = "am";  var Swatch = "@" + (((utime/86400000)%1)+(1/24)).toString().substring(2,5);  var decimaltime = ((hours/24)+(minutes/1440)+(seconds/86400)+(milliseconds/86400000));  decimaltime = decimaltime.toString().substring(1,7);  var udect = ((utime/86400000)%1).toString().substring(1,7);  var totalseconds = (hours * 3600 + minutes * 60 + seconds + milliseconds / 1000);  var gotime = utime/864 + 50000;  var umt1 = gotime.toString().substring(5,7);  var umt2 = gotime.toString().substring(7,10);  with (Math) {    var hextime = floor(totalseconds / 1.318359375);    var hex1 = floor(hextime / 4096);    hextime -= 4096 * hex1;    var hex2 = floor(hextime / 256);    hextime -= 256 * hex2;    var hex3 = floor(hextime / 16);    hextime -= 16 * hex3;    var hex4 = hextime;  }  var hexadecimalValue = hex[hex1] + "_"+ hex[hex2] + hex[hex3] + "_" + hex[hex4];  if (day==0)    day="Sun";  if (day==1)    day="Mon";  if (day==2)    day="Tue";  if (day==3)    day="Wed";  if (day==4)    day="Thu";  if (day==5)    day="Fri";  if (day==6)    day="Sat";  if (GMTday==0)    GMTday="Sun";  if (GMTday==1)    GMTday="Mon";  if (GMTday==2)    GMTday="Tue";  if (GMTday==3)    GMTday="Wed";  if (GMTday==4)    GMTday="Thu";  if (GMTday==5)    GMTday="Fri";  if (GMTday==6)    GMTday="Sat";  if (month <= 9) month = "0" + month;  if (date <= 9) date = "0" + date;  if (hours > 11) apm = "pm";  if (hours > 12) hours = hours - 12;  if (hours == 0) hours = 12;  if (hours <= 9) hours = "0" + hours;  if (minutes <= 9) minutes = "0" + minutes;  if (seconds <= 9) seconds = "0" + seconds;  if (GMTmonth <= 9) GMTmonth = "0" + GMTmonth;  if (GMTdate <= 9) GMTdate = "0" + GMTdate;  if (GMThours <= 9) GMThours = "0" + GMThours;  if (GMTminutes <= 9) GMTminutes = "0" + GMTminutes;  if (GMTseconds <= 9) GMTseconds = "0" + GMTseconds;  var NETbase = utime/86400000*360;  var NETdegrees = Math.floor(NETbase%360);  var NETminutes = Math.floor((NETbase*60)%60);  if (NETminutes <= 9) NETminutes = "0" + NETminutes;  var NETstring = NETdegrees + "°" + NETminutes + "' NET";  var localValue = "Local Date/Time: " + year + "." + month + "." + date + " " + day + " " + hours + ":" + minutes + ":" + seconds + "." + milliseconds + " " + apm;  var GMTValue = "GMT/UTC Date/Time: " + GMTyear + "." + GMTmonth + "." + GMTdate + " " + GMTday + " " + GMThours + ":" + GMTminutes + ":" + GMTseconds + "." + milliseconds;  var dtimeValue = "Local Decimal Time: " + decimaltime;  var udtimeValue = "Decimal Time GMT: " + udect; // decimaltime.hynes.net  var umtValue = "Universal Metric Time: " + umt1 + "." + umt2; // More at Zapatopi.net  var hexValue = "Hexadecimal Time: " + hexadecimalValue; // More at intuitor.com/hex  var unixValue = "Milliseconds since 1/1/1970 00:00 GMT: " + utime;  var SwatchValue = "Swatch Internet Time: " + Swatch + " .beats"; // More at Swatch.com  var NETValue = "New Earth Time: " + NETstring; // More at Newearthtime.net  document.clock.localface.value = localValue;  document.clock.GMTface.value = GMTValue;  document.clock.dtimeface.value = dtimeValue;  document.clock.udtimeface.value = udtimeValue;  document.clock.umtface.value = umtValue;  document.clock.hexface.value = hexValue;  document.clock.unixface.value = unixValue;  document.clock.Swatchface.value = SwatchValue;  document.clock.NETface.value = NETValue;  //Countdown  var cyear = 2008;  //  enter 4-digit year  var cmonth = 0;    //  0 for January, 1 for February ... 11 for December  var cdate = 1;   //  day of the month  var chours = 0;    //  24-hour only  var cminutes = 0;  var cseconds = 0;  var cms = 0;   //  milliseconds  var description = "New Year's 2008";  var future = new Date(cyear,cmonth,cdate,chours,cminutes,cseconds,cms);  var future2 = future.getTime();  countdown = future - utime;  countsec = Math.floor(countdown/1000);  countdays = Math.floor(countdown/86400000*1000)/1000;  var csValue = "Seconds until " + description + ": " + countsec;  var cdValue = "Days until " + description + ": " + countdays;  document.clock.csface.value = csValue  document.clock.cdface.value = cdValue  setTimeout("clock()", 1);}--></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onLoad="clock()"><form name="clock" enctype="text/plain" onsubmit="0"><input type="text" name="localface" size="52" value="Loading" readonly><br><input type="text" name="GMTface" size="52" value="Loading" readonly><br><input type="text" name="dtimeface" size="52" value="Loading" readonly><br><input type="text" name="udtimeface" size="52" value="Loading" readonly><br><input type="text" name="umtface" size="52" value="Loading" readonly><br><input type="text" name="hexface" size="52" value="Loading" readonly><br><input type="text" name="unixface" size="52" value="Loading" readonly><br><input type="text" name="Swatchface" size="52" value="Loading" readonly><br><input type="text" name="NETface" size="52" value="Loading" readonly><br><input type="text" name="csface" size="52" value="Loading" readonly><br><input type="text" name="cdface" size="52" value="Loading" readonly></form></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->