title: Java: How to compare two Times/Dates
body: <p>I am retrieving value from my notepad(database) like this </p>
  
  <pre><code>            strLine = br.readLine().trim();
              if ((strLine.length()!=0) &amp;&amp; (strLine.charAt(0)!='#')) {
              String[] teachers = strLine.split("\\s+");
               Interviews interview = new Interviews();
               interview.setTime(teachers[4]+" "+ teachers[5]);
  </code></pre>
  
  <p>at this point my timevalue is   ( given be debugger)</p>
  
  <pre><code>             "2011-9-5 0:00"
  </code></pre>
  
  <p>I want this Time to be compare with some other Time</p>
  
  <p>But when i try to parse these values in a date format </p>
  
  <pre><code>              SimpleDateFormat df=new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
                 Date d1=df.parse(interviewList.get(0).getTime());
  </code></pre>
  
  <p>It gives me error</p>
  
  <pre><code>             java.text.ParseException: Unparseable date: "2011-9-5 0:00"
  </code></pre>
  
  <p>This is the format i have in my Notepad (Database) 2011-9-5 0:00  </p>
  
  <p>How can i compare this value as a Time with some other Time </p>
  
  <p>Thanks</p>