title: JavaScript compare two time strings
body: <p>I have two string for time, one is current time and the other one is twenty minutes later. Here is the output:</p>
  
  <pre><code>10/1/2017 1:20:58 PM
  10/1/2017 1:40:58 PM
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>var now = new Date();
  console.log(now.toLocaleDateString() + " " + now.toLocaleTimeString());
  var in20 = new Date(now.getTime() + (1000*60*20));
  console.log(in20.toLocaleDateString() + " " + in20.toLocaleTimeString());
  </code></pre>
  
  <p>Is there any way to check if the variable for twenty minutes later is before or after the current time variable as I not sure how to make time comparison based on two time strings. If it is after current time variable, return a true, otherwise return a false.</p>
  
  <p>Any ideas? Thanks!</p>