title: Check current time lies in two times in java
body: <p>I am trying to check whether current time is between <em>Start Time</em> and <em>End time</em>. But my method always return false:</p>
  
  <p><strong>from = "5:10:00";
  to = "10:10:00"</strong></p>
  
  <hr>
  
  <pre><code>private boolean isTimeBetweenTwoTime(String from, String to) throws ParseException {
      SimpleDateFormat formatter = new SimpleDateFormat("H:mm:ss");
  
      Date date_from = formatter.parse(from);
      Date date_to = formatter.parse(to);
  
      Time startTime = new Time(date_from.getTime());
      Time endTime = new Time(date_to.getTime());
  
      Calendar c = Calendar.getInstance();
      Time now = new Time(c.getTimeInMillis());
  
      if (now.before(endTime) &amp;&amp; now.after(startTime)) {
          Log.d(LOG_TAG, "Yes time between");
          return true;
      }
  
      return false;
  }
  </code></pre>