title: How to check if current time falls within a specific range considering also minutes
body: <p>I am doing a Website for Restaurants Home Delivery ,depending on Restaurant's  Home Delivery Timings i need to enable / disable Order Now Button</p>
  
  <p>I have got startTime and End Time in 12 Hour format .</p>
  
  <p>This is the code </p>
  
  <pre><code>var startTime = '8:30 AM' ;
  var endTime  =  '6:30 PM' ;
  
  
  var formatTime = (function () {
      function addZero(num) {
          return (num &gt;= 0 &amp;&amp; num &lt; 10) ? "0" + num : num + "";
      }
      return function (dt) {
          var formatted = '';
  
          if (dt) {
              var hours24 = dt.getHours();
              var hours = ((hours24 + 11) % 12) + 1;
              formatted = [formatted, [addZero(hours), addZero(dt.getMinutes())].join(":"),hours24&gt;11?"pm" :"am"].join(" ");            
          }
          return formatted;
      }
  })();
  
  
  var currentTime = formatTime(new Date());
  </code></pre>
  
  <p>I need to check if the current time is in between startTime and EndTime or not </p>
  
  <p>If its only Hours ,i could have extracted the first character before colon from startTime ,endTime and currentTime and done a comparision like this</p>
  
  <pre><code>  if(currentTime &gt;= startTime &amp;&amp; currentTime &lt;= endTime) 
  {
  alert('Restaurant Open');
  }
  else
  {
  alert('Restaurant Closed');
  }
  </code></pre>
  
  <p>But i need to take the minutes also in consideration ,so could you please let me how to do this comparsion if minutes were takein in consideration ??</p>
  
  <p>How to check if current time falls within a specific range considering also minutes</p>