title: Android Date incorrect results
body: <p>I am getting the dates from twitter status feed. </p>
  
  <p>I am trying to find out all the latest updates (past 24 hours)</p>
  
  <pre><code>long referenceTime =System.currentTimeMillis()-(24*60*60*1000);
  
  //ti.getDateTime() returns the string time returned from twitter..
  long statusTime =DateUtil.convertStringToDate(ti.getDateTime(), "EEE MMM dd HH:mm:ss ZZZZZ yyyy").getTime();
  
  if(statusTime&gt;referenceTime )
  {
      Log.d(TAG,"Recent update");
  }
  </code></pre>
  
  <p>Now for the following dates it returns as "Recent update"
  //Current system time 9:52 am sep 30 2011 </p>
  
  <pre><code>Thu Sep 29 11:28:16 +0000 2011 // Correct
  Thu Sep 29 11:33:07 +0000 2011 // Correct
  Fri Mar 25 16:15:05 +0000 2011 // Incorrect
  Tue Mar 22 19:32:38 +0000 2011 // Incorrect
  Sat Jul 24 12:05:49 +0000 2010 // Incorrect
  Wed Jul 14 23:56:27 +0000 2010 // Incorrect
  </code></pre>
  
  <p>[These are the strings that ti.getDateTime() returns.]
  Why is it happening so ?</p>
  
  <p>and its pretty much random since the following dates the log is not printed.</p>
  
  <pre><code>Fri Jul 09 22:07:53 +0000 2010
  Fri Jul 09 21:17:23 +0000 2010
  Tue Apr 26 22:33:59 +0000 2011
  </code></pre>
  
  <p>DateUtil :</p>
  
  <pre><code>public static final Date convertStringToDate(String date, String entryFormat) {
      Date theDate = null;
      try {
          //SimpleDateFormat formatter  = new SimpleDateFormat( "MMMM d, yyyy");"yyyy-mm-dd"
          SimpleDateFormat formatter  = new SimpleDateFormat( entryFormat);
          theDate = formatter.parse(date);
      } catch (Exception e){          
      }
      return theDate;
  }
  </code></pre>