private String formatCharacterTemporal(int value, Token token) {
    String output = null;
    if (token.temporalField == ChronoField.MONTH_OF_YEAR) {
      output = Month.of(value).getDisplayName(TextStyle.FULL, Locale.US);
    } else if (token.temporalField == ChronoField.DAY_OF_WEEK) {
      output = DayOfWeek.of(value).getDisplayName(TextStyle.FULL, Locale.US);
    }
    if (output == null) {
      throw new IllegalStateException("TemporalField: " + token.temporalField + " not valid for "
          + "character formatting.");
    }

    // set length
    if (output.length() > token.length) {
      output = output.substring(0, token.length); // truncate to length
    } else if (!token.fillMode && output.length() < token.length) {
      output = StringUtils.rightPad(output, token.length); //pad to size
    }

    // Set case.
    // If the first letter is lowercase then the output is lowercase: 'mONTH' -> 'may'
    // If the first two letters are uppercase then the output is uppercase: 'MOnth' -> 'MAY'
    // If the first letter is uppercase and the second is lowercase then the output is capitalized:
    //     'Month' -> 'May'.
    if (Character.isLowerCase(token.string.charAt(0))) {
      output = output.toLowerCase();
    } else if (Character.isUpperCase(token.string.charAt(1))) {
      output = output.toUpperCase();
    } else {
      output = capitalize(output);
    }
    return output;
  }
Make sure the generated list of tokens is valid for formatting datetime objects to strings.
common/src/java/org/apache/hadoop/hive/common/format/datetime/HiveSqlDateTimeFormatter.java