title: Comparing two timestamps
body: <p>I want to compare the following two timestamps. It should return <code>true</code> but due to single digit and double digit milliseconds in the two timestamps, it is returning <code>false</code>. What can I do to make it return <code>true</code></p>
  
  <pre><code>public static void main(String[] args) throws ParseException {
      String d1 = "2011-12-31 07:11:01.5";
      String d2 = "2011-12-31 07:11:01.50";
      SimpleDateFormat s1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
      SimpleDateFormat s2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS");
  
      Date dateOne = s1.parse(d1);
      Date dateTwo = s2.parse(d2);
  
      System.out.println(dateOne.equals(dateTwo));
  }
  </code></pre>