title: java Compare two dates
body: <p>I want to compare two dates and check if the date has expired or not.</p>
  
  <p>Here is the code I used :</p>
  
  <pre><code>SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:ss:ii");
  Date date1 = sdf.parse("20012-10-4 10:15:25");
  Date date2 = sdf.parse("2013-10-4 10:15:25");
  
  if(date1.equals(date12)){
      System.out.println("Both are equals");
  }
  </code></pre>
  
  <p>I want to check the two dates but without success.</p>
  
  <p>I also tried to check it like that :</p>
  
  <pre><code>if(date1 &gt;= date2){
      System.out.println("Both are not equals");
  }
  </code></pre>
  
  <p>But it's not working either.</p>