title: Convert string to datetime in javascript and compare with current time
body: <p>I am trying to pick up value from datetimepicker tetxbox and compare those values with current time.</p>
  
  <p><a href="http://jsfiddle.net/jah79yhj/" rel="nofollow"><strong>JSFiddle</strong></a></p>
  
  <pre><code>        //startTime textbox text = 19/12/2014 03:58 PM
          var startTime = Date.parse($('[id$=txtStartDate]').val().toString());
  
          //endTime textbox text = 19/12/2014 04:58 PM
          var endTime = Date.parse($('[id$=txtEndDate]').val().toString());
  
          var currentTime = Date.now();
          alert(startTime);
          alert(endTime);
          alert(currentTime);
  
          if (currentTime &gt;= startTime &amp;&amp; currentTime &lt;= endTime) {
                alert();
  
          }
  </code></pre>
  
  <p>Date.parse() is used fro converting string to milliseconds since Jan 1 1970.
  Date.now() returns current date milliseconds since Jan 1 1970.</p>
  
  <p>But the above conversion methods are not working properly.
  What should be logic to compare datetime by first sonverting string in format like <strong>19/12/2014 03:58 PM</strong> to Date object and then do comparing.</p>