title: Java Cannot Format Given Object as Date
body: <p>I have a string with yyyyMMdd format and I want dd.MM.yyyy</p>
  
  <p>I get this error with my code</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Cannot format given Object as a
    Date</p>
  </blockquote>
  
  <pre><code>String date = "20190226";
  SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");                  
  date = sdf.format(date);
  </code></pre>
  
  <p>Any help?</p>