title: DateTimeFormatter - java.lang.IllegalArgumentException: Too many pattern letters: a
body: <p>I have the following line in my <code>java</code> code where I am trying to format a date string</p>
  <pre><code> ZonedDateTime zonedDateTime= ZonedDateTime.ofInstant(instant, tz);
   DateTimeFormatter formatter = DateTimeFormatter.ofPattern(&quot;yyyy-MM-dd HH:mm aa&quot;);
  
   return zonedDateTime.format(formatter);
  </code></pre>
  <p>At line 2 , I am getting this error:</p>
  <pre><code>java.lang.IllegalArgumentException: Too many pattern letters: a
  at java.time.format.DateTimeFormatterBuilder.parseField(DateTimeFormatterBuilder.java:1774)
  </code></pre>
  <p>How can I create a format string for <code>DateTimeFormatter.ofPattern</code> that will give e.g:</p>
  <pre><code>2023-04-21 7.00pm
  </code></pre>