Java 8 DateTimeFormatter: confusion with 'z' and 'Z ' pattern letters
<p>I have the date string "2015-01-12T13:00:00.000+02:00".
Looking at the JavaDoc I see the following:</p>

<blockquote>
<pre><code>z       time-zone name              zone-name         Pacific Standard Time; PST
Z       zone-offset                 offset-Z          +0000; -0800; -08:00;
</code></pre>
</blockquote>

<p><br>
So I would suspect that to parse it I would have to use upper-case 'Z' because I have the Zone format given in +02:00:</p>

<pre><code>DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.000Z");
</code></pre>

<p>But with that I get a parse error.</p>

<p>If I use lower-case 'z' it works:</p>

<pre><code>DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.000z")
</code></pre>

<p><br>
Does anyone know what is going on?</p>

<hr>

<p>CODE:</p>

<pre><code>DateTimeFormatter changetimeParser_Z = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.000Z");
DateTimeFormatter changetimeParser_z = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.000z");

String time = "2015-01-12T13:00:00.000+02:00";

ZonedDateTime time1 = ZonedDateTime.parse(time, changetimeParser_z);
System.out.println(time1);
ZonedDateTime time2 = ZonedDateTime.parse(time, changetimeParser_Z);

System.out.println(time2);
</code></pre>

<p><br>
Exception stack trace:</p>

<pre><code>2015-01-12T13:00+02:00
java.time.format.DateTimeParseException: Text '2015-01-12T13:00:00.000+02:00' could not be parsed at index 23
    at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949)
    at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1851)
    at java.time.ZonedDateTime.parse(ZonedDateTime.java:597)
</code></pre>