title: DateTimeFormatter trouble with a pattern
body: <p>I am writing a stock program that (so far) gets the data from &quot;Markit on Demand&quot; through a request such as this:</p>
  <p><a href="http://dev.markitondemand.com/Api/v2/Quote/xml?symbol=aapl" rel="nofollow noreferrer">http://dev.markitondemand.com/Api/v2/Quote/xml?symbol=aapl</a></p>
  <p>This returns the data in xml, with various measures of the stock (Symbol, name, last price, change, time stamp, etc).</p>
  <p>I am having trouble creating a DateTimeFormatter in Java 8 to make the timestamp.</p>
  <p>One example of a timestamp:</p>
  <p><code>Fri Jul 18 15:59:00 UTC-04:00 2014</code></p>
  <p>So far the pattern I have is as follows:</p>
  <p><code>EEE MMM d HH:mm:ss OOOO yyyy</code></p>
  <p>As I'm sure some of you can spot, I am having trouble with the offset.</p>
  <p>From the Documentation:</p>
  <blockquote>
  <p>Offset X and x: This formats the offset based on the number of pattern letters. One letter outputs just the hour, such as '+01', unless the minute is non-zero in which case the minute is also output, such as '+0130'. Two letters outputs the hour and minute, without a colon, such as '+0130'. Three letters outputs the hour and minute, with a colon, such as '+01:30'. Four letters outputs the hour and minute and optional second, without a colon, such as '+013015'. Five letters outputs the hour and minute and optional second, with a colon, such as '+01:30:15'. Six or more letters throws IllegalArgumentException. Pattern letter 'X' (upper case) will output 'Z' when the offset to be output would be zero, whereas pattern letter 'x' (lower case) will output '+00', '+0000', or '+00:00'.</p>
  <p>Offset O: This formats the localized offset based on the number of pattern letters. One letter outputs the short form of the localized offset, which is localized offset text, such as 'GMT', with hour without leading zero, optional 2-digit minute and second if non-zero, and colon, for example 'GMT+8'. Four letters outputs the full form, which is localized offset text, such as 'GMT, with 2-digit hour and minute field, optional second field if non-zero, and colon, for example 'GMT+08:00'. Any other count of letters throws IllegalArgumentException.</p>
  <p>Offset Z: This formats the offset based on the number of pattern letters. One, two or three letters outputs the hour and minute, without a colon, such as '+0130'. The output will be '+0000' when the offset is zero. Four letters outputs the full form of localized offset, equivalent to four letters of Offset-O. The output will be the corresponding localized offset text if the offset is zero. Five letters outputs the hour, minute, with optional second if non-zero, with colon. It outputs 'Z' if the offset is zero. Six or more letters throws IllegalArgumentException.</p>
  </blockquote>
  <pre><code>// String rawDate = Fri Jul 18 15:59:00 UTC-04:00 2014   
  DateTimeFormatter PARSER_PATTERN = DateTimeFormatter.ofPattern(&quot;EEE MMM d HH:mm:ss 'UTC'XXX yyyy&quot;);
  ZonedDateTime timeStamp = ZonedDateTime.parse(rawDate, PARSER_PATTERN);
  </code></pre>
  <p>This works, but I am curious why (in place of the 'UTC'XXX) <code>OOOO</code> doesn't work.</p>