title: Java SimpleDateformatter with 10 decimals after the seconds, cannot convert to Date
body: <p>I'm trying to convert date string with 10 milliseconds (2018-11-02 6:05:59.1541162159 PM) to date but not able get the exact date.</p>
  
  <p>Code to convert:</p>
  
  <pre><code>import java.text.SimpleDateFormat;
  import java.util.Calendar;
  import java.util.Date;
  import java.util.TimeZone;
  
  public class DateFormatCheck {
      private static TimeZone tz = TimeZone.getTimeZone("Asia/Colombo");
      private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS aa");
  
      public static void main(String[] a){
          try {
              Calendar cal = Calendar.getInstance(tz);
              sdf.setCalendar(cal);
              cal.setTime(sdf.parse("2018-11-02 6:05:59.1541162159 PM"));
              Date date = cal.getTime();
              System.out.println(date);
          }catch (Exception e){
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Tue Nov 20 02:12:01 IST 2018
  </code></pre>