title: Javascript countdown timer not working correctly
body: <p>I'm creating a javascript function to countdown a user selected value. This is my code so far.</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 countdownTimeStart() {
    var time = document.getElementById("test").value;
    time = time.split(':');
    var date = new Date();
    var countDownDate = date.setHours(time[0], time[1], time[2]);
    var x = setInterval(function () {
      // Get to days date and time
      var now = new Date().getTime();
  
      // Find the distance between now an the count down date
      /* var distance = countDownDate;*/
      var distance = countDownDate - now;
  
      // Time calculations for days, hours, minutes and seconds
      var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
      var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
      var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  
      // Output the result in an element with id="demo"
      document.getElementById("demo1").innerHTML = hours + ": "
        + minutes + ": " + seconds + " ";
  
      // If the count down is over, write some text
      if (distance &lt; 0) {
        clearInterval(x);
        document.getElementById("demo1").innerHTML = "00:00:00";
      }
    }, 200);
  }
  document.querySelector("button").addEventListener(
    "click",
    countdownTimeStart
  )</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type = "test" id = "test" value="20:12:40"&gt;
  &lt;div id="demo1"&gt;&lt;/div&gt;
  &lt;button&gt;start&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The problem is countdown is not working properly. The count down time start from another time instead of start from 20:12:40 which comes from input tag. </p>
  
  <p>Please help me to solve this.</p>