title: How to convert a date to dd.MM.yyyy format in Java?
body: <p>How can I convert the date<code>(Mon Jan 12 00:00:00 IST 2015)</code> in the format <code>MM.dd.yyyy</code> or <code>dd.MM.yyyy</code>?</p>
  
  <p>I tried using the below approach </p>
  
  <pre><code>    String dateStr = "Mon Jan 12 00:00:00 IST 2015";
  
      DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
      System.out.println(formatter.format(dateStr));
  </code></pre>
  
  <p>but got,</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: 
  Cannot format given Object as a Date
  </code></pre>