title: comparing current time with input time in javascript
body: <p>From the following html and javascript code i hope to compare the input time with current time! If the input time is less than 2 hours i want to print "Less time" in the label and if its more than 2 hours i want to print "sufficient time" in the label!</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 test(){
       var element = document.getElementById("time").value;
       var d = new Date();
          var n = d.getTime();
       if(element-n&gt;2){
         document.getElementById("check").innerHTML="sufficient time";
       }
       else{
        document.getElementById("check").innerHTML="Less time";
       
       }
      }
   </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;html&gt;
      
      &lt;body&gt;
       &lt;form&gt;
        &lt;span&gt;Time&lt;/span&gt;
       &lt;input type="time" id="time"&gt;
        
          &lt;input type="button" value="CHECK"   onclick="test();"&gt; &lt;br&gt;
        &lt;label id="check"&gt;&lt;/label&gt;
                &lt;input class="button" type=reset name=reset value=Cancel&gt;
       &lt;/form&gt;
      &lt;/body&gt;
      &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>when i evaluate this i always get less time! How can i correct mycode?</p>