title: Javascript HTML Multiple Timezone Clock
body: <p>How would I bring together my checkTime and checkMinute function into one so that when I do an offset of (m + 30) it will also make h go to the next hour when m reaches 60. Thanks! </p>
  
  <p>Currently My code tells the time and can take on offset for hours on a 24 hour scale, my issue is it does not allow me to change the code in offset of + 30 minutes which I would like the ability to do. </p>
  
  <p>My if statements aren't getting me the outcome I want which is when minutes hit 60 from doing an offset of + 30 then the hour will go to the next one instead of only affecting the minutes. </p>
  
  <p>I believe I would need to bring the two function together but am not sure how to do this accurately.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function addLeadingZero(n) {
    return n &lt; 10 ? '0' + n : n;
  }
  
  function timeClock(timeZoneOffset) {
    var d = new Date();
    d.setHours(d.getUTCHours() + timeZoneOffset); // set time zone offset
    var h = d.getUTCHours();
    var m = d.getUTCMinutes();
    var s = d.getUTCSeconds();
    /*    h = h % 12;
        h = h ? h : 12; // replace '0' w/ '12'  */
    /*  h = checkHour(h)  */
    m = checkTime(m);
    s = checkTime(s);
    h = addLeadingZero(h);
  
    document.all["txt3"].innerHTML = /*+ checkHour*/ (h - 4) + ':' + m + ':' + s + ' ';
    document.all["txt1"].innerHTML = /*+ checkHour*/ (h + 3) + ':' + m + '' + ' ';
    document.all["txt2"].innerHTML = h + ':' + checkMinute(m + 30) + '' + ' ';
    document.all["txt4"].innerHTML = h + ':' + m + '' + ' ';
    document.all["txt5"].innerHTML = h + ':' + m + '' + ' ';
    setTimeout(function() {
      timeClock(timeZoneOffset)
    }, 500);
  }
  
  function checkTime(i) {
    var j = i;
    if (i &lt; 10) {
      j = "0" + i;
    }
    return j;
  }
  
  function checkHour(i) {
    var j = i;
    if (i &gt; 23) {
      j = j - 24;
    }
    if (i &lt; 0) {
      j = "0" + i;
    }
    return j;
  }
  
  function checkMinute(i) {
    var j = i;
    if (i &gt; 59) {
      j = j - 60;
    }
    if (i &lt; 0) {
      j = "0" + i;
    }
    return j;
  }
  
  /* setInterval(function() {
        startTime();
        }, 500);
      })(jQuery);    */
  
  window.onload = function() {
    timeClock(2);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="txt3"&gt;&lt;/div&gt;
  &lt;div id="txt1"&gt;&lt;/div&gt;
  &lt;div id="txt2"&gt;&lt;/div&gt;
  &lt;div id="txt4"&gt;&lt;/div&gt;
  &lt;div id="txt5"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>