code: private StringBuffer format(Calendar cal, DisplayContext capitalizationContext,
              StringBuffer toAppendTo, FieldPosition pos, List<FieldPosition> attributes) {
          // Initialize
          pos.setBeginIndex(0);
          pos.setEndIndex(0);
  
          // Careful: For best performance, minimize the number of calls
          // to StringBuffer.append() by consolidating appends when
          // possible.
  
          Object[] items = getPatternItems();
          for (int i = 0; i < items.length; i++) {
              if (items[i] instanceof String) {
                  toAppendTo.append((String)items[i]);
              } else {
                  PatternItem item = (PatternItem)items[i];
                  int start = 0;
                  if (attributes != null) {
                      // Save the current length
                      start = toAppendTo.length();
                  }
                  if (useFastFormat) {
                      subFormat(toAppendTo, item.type, item.length, toAppendTo.length(),
                                i, capitalizationContext, pos, cal);
                  } else {
                      toAppendTo.append(subFormat(item.type, item.length, toAppendTo.length(),
                                                  i, capitalizationContext, pos, cal));
                  }
                  if (attributes != null) {
                      // Check the sub format length
                      int end = toAppendTo.length();
                      if (end - start > 0) {
                          // Append the attribute to the list
                          DateFormat.Field attr = patternCharToDateFormatField(item.type);
                          FieldPosition fp = new FieldPosition(attr);
                          fp.setBeginIndex(start);
                          fp.setEndIndex(end);
                          attributes.add(fp);
                      }
                  }
              }
          }
          return toAppendTo;
  
      }
docs: then attribute information will be recorded.