Ejemplos en Javascript

Husos horarios: cuarto ejemplo

Husos horarios con ligeras variantes respecto a los anteriores.

<HTML>
<HEAD>

<TITLE>Ejemplos Javascript: ejemplo pr???¡ctico </TITLE>

<script language="javascript">
<!-- Clock in Java Script .. Cameron Gregory cameron@corona.att.com
// http://www.att.com/homes/cameron/
speed=1000;
len=28;
tid = 0;
num=0;
clockA = new Array();
offsetA = new Array();
dd = new Date();

function doDate(x)
{
  for (i=0;i<num;i++) {
    dt = new Date();
 
    if (offsetA[i] != 0) {
      gt = dt.getTime();
      gt = gt + offsetA[i];
      dt.setTime(gt);
      }
 
    clockA[i].date.value = dt;
    }

  tid=window.setTimeout("doDate()",speed);
}

function start() {
  clockA[num] = document.forms[num];
  offsetA[num] = 0;
  if (num == 0)  
    tid=window.setTimeout("doDate()",speed);
  num++;
}

function startLong(diff) {
  clockA[num] = document.forms[num];
  offsetA[num] = (diff - dd.getTimezoneOffset())*60*1000;
  if (num == 0)  
    tid=window.setTimeout("doDate()",speed);
  num++;
}

function cleartid() {
  window.clearTimeout(tid);
}
 
// for some reason on some pages this crashes netscape
function Clock()
{
  document.write('<FORM name=form'+num+'><input name=date size=')
  document.write(len)
  document.write(' value="Clock: Requires Javascript"></FORM>')
  start();
}
 
// for some reason on some pages this crashes netscape
function ServerClock(diff)
{
  document.write('<FORM name=form'+num+'><input name=date size=')
  // we chop the end, because it would be the wrong timezone
  document.write(19)
  document.write(' value="Clock: Javascript"></FORM>')
  startLong(diff);
}
// end-->
</script>

</HEAD>

<BODY bgcolor="white">

<script language="javascript">
// You need a javascript compatible browser to view the following <br>
document.write('<table><tr><th>Local Time</th><td>');
Clock();
document.write('</td></tr><tr><th>Calforinia (-420)</th><td>');
ServerClock(-420);
document.write('</td></tr><tr><th>New Jersey (-240)</th><td>');
ServerClock(-240);
document.write('</td></tr><tr><th>Slovakia(120)</th><td>');
ServerClock(120);
document.write('</td></tr><tr><th>Townsville, Australia (600)</th><td>');
ServerClock(600);
document.write('</td></tr><tr><th>Greenwich Mean Time - GMT (0)</th><td>');
ServerClock(0);
document.write('</td></tr></table>');
// end javascipt section <br>
</script>



</body>
</html>

Fechas y horarios