title: Java Date Format from yyyy-MM-dd'T'HH:mm:ss.SSS+ZZZZ
body: <p>Formatting the date somehow is giving me an exception.</p>
  
  <p>The date string that I want to convert to a Date object => <code>2019-12-12T15:31:31.000+0000</code></p>
  
  <p>Code for converting which gives the error <code>Text '2019-12-12T15:31:31.000+0000' could not be parsed at index 24</code></p>
  
  <pre><code>        Date date;
          try {
              DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'+'Z");
              ZonedDateTime formatDateTime = ZonedDateTime.parse(dateString,formatter);
              date = Date.from(formatDateTime.toInstant());
  
              return date.toString();
  
          }catch (Exception ex){
              return ex.getLocalizedMessage();
          }
  </code></pre>
  
  <p>I'm not sure why this isn't working, the Date has been a huge problem for me in Java. In C# there's hardly any work that needs to be done but I couldn't figure out how to parse a date string in Java.</p>
  
  <p>Help is appreciated, thanks people.</p>