How to format date/time string? (Java)
<p>Hi can anyone help please? I am trying to format a date and time string.
Currently it looks like this "<code>20160112T110000Z</code>" and I need it to be "<code>2016-01-12T11:00:00Z</code>"</p>

<p>The string without the special characters are returned from a 3rd party recurrence library. I need to convert it to have the special characters before parsing it to a <code>Calendar</code> object.</p>

<p>Can anyone help please?</p>

<p>The code that I have so far looks like:</p>

<pre><code> final String TIMEFORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
 String string = "20160112T110000Z";
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    Date date = format.parse(string);
    System.out.println(date); 
</code></pre>

<p>However this just does not work.</p>

<p>Any suggestions are appreciated</p>