Formatting Instant to String with specific pattern
<p>I'm trying to format <code>Instant</code> to <code>String</code> with a specific format. Based on the question here <a href="https://stackoverflow.com/questions/25229124/format-instant-to-string">Format Instant to String</a>, I'm doing this - </p>

<pre><code>DateTimeFormatter formatter = DateTimeFormatter
        .ofPattern("YYYY-MM-DD'T'hh:mm'Z'")
        .withZone(ZoneOffset.UTC);

// Fails for current time with error 'Field DayOfYear cannot be printed as the 
// value 148 exceeds the maximum print width of 2'
LocalDateTime 
      .ofInstant(Instant.now(), ZoneOffset.UTC)
      .format(DATE_TIME_FORMATTER);

// But works for smaller values of Instant    
LocalDateTime
     .ofInstant(Instant.ofEpochMilli(604800000), ZoneOffset.UTC)
     .format(DATE_TIME_FORMATTER));
</code></pre>

<p>Any suggestions on why is this happening?</p>

<p>Thanks</p>