// 例如field=YEAR,width=2,baseValue=2018,那么当前格式化的实例的有效值为[2018,2117],2019->1,2117->99 // width范围是[1,10],maxWidth范围是[1,10] public DateTimeFormatterBuilder appendValueReduced(TemporalField field, int width, int maxWidth, int baseValue) public DateTimeFormatterBuilder appendValueReduced(TemporalField field, int width, int maxWidth, ChronoLocalDate baseDate)
追加小数(点)配置:
// decimalPoint = true则输出小数,minWidth范围是[0,9],maxWidth范围是[1,9] public DateTimeFormatterBuilder appendFraction(TemporalField field, int minWidth, int maxWidth, boolean decimalPoint)
追加文本格式配置:
public DateTimeFormatterBuilder appendText(TemporalField field) public DateTimeFormatterBuilder appendText(TemporalField field, TextStyle textStyle) public DateTimeFormatterBuilder appendText(TemporalField field, Map<Long, String> textLookup)
追加瞬时时间配置:
public DateTimeFormatterBuilder appendInstant() public DateTimeFormatterBuilder appendInstant(int fractionalDigits)
追加时区相关的配置:
// 时间偏移量如+01:00 public DateTimeFormatterBuilder appendOffsetId() // 指定格式的时间偏移量 public DateTimeFormatterBuilder appendOffset(String pattern, String noOffsetText) // 指定文本风格的本地时间偏移量 public DateTimeFormatterBuilder appendLocalizedOffset(TextStyle style) public DateTimeFormatterBuilder appendZoneId() public DateTimeFormatterBuilder appendZoneRegionId() public DateTimeFormatterBuilder appendZoneOrOffsetId() public DateTimeFormatterBuilder appendZoneText(TextStyle textStyle) public DateTimeFormatterBuilder appendZoneText(TextStyle textStyle, Set<ZoneId> preferredZones) // 太平洋时间时区偏移量 public DateTimeFormatterBuilder appendGenericZoneText(TextStyle textStyle) public DateTimeFormatterBuilder appendGenericZoneText(TextStyle textStyle, Set<ZoneId> preferredZones) // 日历配置 public DateTimeFormatterBuilder appendChronologyId() public DateTimeFormatterBuilder appendChronologyText(TextStyle textStyle)
追加本地日期时间配置:
public DateTimeFormatterBuilder appendLocalized(FormatStyle dateStyle, FormatStyle timeStyle)
追加常量文字(字符串)配置:
public DateTimeFormatterBuilder appendLiteral(char literal) public DateTimeFormatterBuilder appendLiteral(String literal)
追加其他格式化器的属性到当期建造器:
public DateTimeFormatterBuilder append(DateTimeFormatter formatter) // 配置候选格式化器 public DateTimeFormatterBuilder appendOptional(DateTimeFormatter formatter)
追加通用格式配置:
// pattern的解析基本包含了上面提到的其他种类的配置 public DateTimeFormatterBuilder appendPattern(String pattern)