title: Comparing two times in android
body: <p>I have tried with the below code to compare two times:</p>
  
  <pre><code>   SimpleDateFormat sdf = new SimpleDateFormat("hh:mm");
      Date inTime = sdf.parse("11:00");
      Date outTime = sdf.parse("10:00");
  
      if(inTime.compareTo(outTime) &gt; 0){
      Toast.makeText(this, "Out time should be greater than In time", Toast.LENGTH_SHORT).show();
      }
  </code></pre>
  
  <p>Above code is working fine.</p>
  
  <p>But if I give in time as 11:00 and out time as 12:00, I am getting above toast message.</p>
  
  <p>I am getting above toast message if I give out time from 12:00 to 12:59. In other cases above code is working fine.</p>
  
  <p>Where I am doing wrong. Please help me.</p>