public class DateTimeFormatterBuilder
extends java.lang.Object
Datetime formatting is performed by the DateTimeFormatter
class.
Three classes provide factory methods to create formatters, and this is one.
The others are DateTimeFormat
and ISODateTimeFormat
.
DateTimeFormatterBuilder is used for constructing formatters which are then used to print or parse. The formatters are built by appending specific fields or other formatters to an instance of this builder.
For example, a formatter that prints month and year, like "January 1970", can be constructed as follows:
DateTimeFormatter monthAndYear = new DateTimeFormatterBuilder() .appendMonthOfYearText() .appendLiteral(' ') .appendYear(4, 4) .toFormatter();
DateTimeFormatterBuilder itself is mutable and not thread-safe, but the formatters that it builds are thread-safe and immutable.
DateTimeFormat
,
ISODateTimeFormat
Constructor and Description |
---|
DateTimeFormatterBuilder()
Creates a DateTimeFormatterBuilder.
|
Modifier and Type | Method and Description |
---|---|
DateTimeFormatterBuilder |
append(DateTimeFormatter formatter)
Appends another formatter.
|
DateTimeFormatterBuilder |
append(DateTimeParser parser)
Appends just a parser.
|
DateTimeFormatterBuilder |
append(DateTimePrinter printer)
Appends just a printer.
|
DateTimeFormatterBuilder |
append(DateTimePrinter printer,
DateTimeParser parser)
Appends a printer/parser pair.
|
DateTimeFormatterBuilder |
append(DateTimePrinter printer,
DateTimeParser[] parsers)
Appends a printer and a set of matching parsers.
|
DateTimeFormatterBuilder |
appendCenturyOfEra(int minDigits,
int maxDigits)
Instructs the printer to emit a numeric century of era field.
|
DateTimeFormatterBuilder |
appendClockhourOfDay(int minDigits)
Instructs the printer to emit a numeric clockhourOfDay field.
|
DateTimeFormatterBuilder |
appendClockhourOfHalfday(int minDigits)
Instructs the printer to emit a numeric clockhourOfHalfday field.
|
DateTimeFormatterBuilder |
appendDayOfMonth(int minDigits)
Instructs the printer to emit a numeric dayOfMonth field.
|
DateTimeFormatterBuilder |
appendDayOfWeek(int minDigits)
Instructs the printer to emit a numeric dayOfWeek field.
|
DateTimeFormatterBuilder |
appendDayOfWeekShortText()
Instructs the printer to emit a short locale-specific dayOfWeek
text.
|
DateTimeFormatterBuilder |
appendDayOfWeekText()
Instructs the printer to emit a locale-specific dayOfWeek text.
|
DateTimeFormatterBuilder |
appendDayOfYear(int minDigits)
Instructs the printer to emit a numeric dayOfYear field.
|
DateTimeFormatterBuilder |
appendDecimal(DateTimeFieldType fieldType,
int minDigits,
int maxDigits)
Instructs the printer to emit a field value as a decimal number, and the
parser to expect an unsigned decimal number.
|
DateTimeFormatterBuilder |
appendEraText()
Instructs the printer to emit a locale-specific era text (BC/AD), and
the parser to expect it.
|
DateTimeFormatterBuilder |
appendFixedDecimal(DateTimeFieldType fieldType,
int numDigits)
Instructs the printer to emit a field value as a fixed-width decimal
number (smaller numbers will be left-padded with zeros), and the parser
to expect an unsigned decimal number with the same fixed width.
|
DateTimeFormatterBuilder |
appendFixedSignedDecimal(DateTimeFieldType fieldType,
int numDigits)
Instructs the printer to emit a field value as a fixed-width decimal
number (smaller numbers will be left-padded with zeros), and the parser
to expect an signed decimal number with the same fixed width.
|
DateTimeFormatterBuilder |
appendFraction(DateTimeFieldType fieldType,
int minDigits,
int maxDigits)
Instructs the printer to emit a remainder of time as a decimal fraction,
without decimal point.
|
DateTimeFormatterBuilder |
appendFractionOfDay(int minDigits,
int maxDigits)
Appends the print/parse of a fractional day.
|
DateTimeFormatterBuilder |
appendFractionOfHour(int minDigits,
int maxDigits)
Appends the print/parse of a fractional hour.
|
DateTimeFormatterBuilder |
appendFractionOfMinute(int minDigits,
int maxDigits)
Appends the print/parse of a fractional minute.
|
DateTimeFormatterBuilder |
appendFractionOfSecond(int minDigits,
int maxDigits)
Appends the print/parse of a fractional second.
|
DateTimeFormatterBuilder |
appendHalfdayOfDayText()
Instructs the printer to emit a locale-specific AM/PM text, and the
parser to expect it.
|
DateTimeFormatterBuilder |
appendHourOfDay(int minDigits)
Instructs the printer to emit a numeric hourOfDay field.
|
DateTimeFormatterBuilder |
appendHourOfHalfday(int minDigits)
Instructs the printer to emit a numeric hourOfHalfday field.
|
DateTimeFormatterBuilder |
appendLiteral(char c)
Instructs the printer to emit a specific character, and the parser to
expect it.
|
DateTimeFormatterBuilder |
appendLiteral(java.lang.String text)
Instructs the printer to emit specific text, and the parser to expect
it.
|
DateTimeFormatterBuilder |
appendMillisOfDay(int minDigits)
Instructs the printer to emit a numeric millisOfDay field.
|
DateTimeFormatterBuilder |
appendMillisOfSecond(int minDigits)
Instructs the printer to emit a numeric millisOfSecond field.
|
DateTimeFormatterBuilder |
appendMinuteOfDay(int minDigits)
Instructs the printer to emit a numeric minuteOfDay field.
|
DateTimeFormatterBuilder |
appendMinuteOfHour(int minDigits)
Instructs the printer to emit a numeric minuteOfHour field.
|
DateTimeFormatterBuilder |
appendMonthOfYear(int minDigits)
Instructs the printer to emit a numeric monthOfYear field.
|
DateTimeFormatterBuilder |
appendMonthOfYearShortText()
Instructs the printer to emit a locale-specific monthOfYear text.
|
DateTimeFormatterBuilder |
appendMonthOfYearText()
Instructs the printer to emit a short locale-specific monthOfYear
text.
|
DateTimeFormatterBuilder |
appendOptional(DateTimeParser parser)
Appends just a parser element which is optional.
|
DateTimeFormatterBuilder |
appendPattern(java.lang.String pattern)
Calls upon
DateTimeFormat to parse the pattern and append the
results into this builder. |
DateTimeFormatterBuilder |
appendSecondOfDay(int minDigits)
Instructs the printer to emit a numeric secondOfDay field.
|
DateTimeFormatterBuilder |
appendSecondOfMinute(int minDigits)
Instructs the printer to emit a numeric secondOfMinute field.
|
DateTimeFormatterBuilder |
appendShortText(DateTimeFieldType fieldType)
Instructs the printer to emit a field value as short text, and the
parser to expect text.
|
DateTimeFormatterBuilder |
appendSignedDecimal(DateTimeFieldType fieldType,
int minDigits,
int maxDigits)
Instructs the printer to emit a field value as a decimal number, and the
parser to expect a signed decimal number.
|
DateTimeFormatterBuilder |
appendText(DateTimeFieldType fieldType)
Instructs the printer to emit a field value as text, and the
parser to expect text.
|
DateTimeFormatterBuilder |
appendTimeZoneId()
Instructs the printer to emit the identifier of the time zone.
|
DateTimeFormatterBuilder |
appendTimeZoneName()
Instructs the printer to emit a locale-specific time zone name.
|
DateTimeFormatterBuilder |
appendTimeZoneName(java.util.Map<java.lang.String,DateTimeZone> parseLookup)
Instructs the printer to emit a locale-specific time zone name, providing a lookup for parsing.
|
DateTimeFormatterBuilder |
appendTimeZoneOffset(java.lang.String zeroOffsetText,
boolean showSeparators,
int minFields,
int maxFields)
Instructs the printer to emit text and numbers to display time zone
offset from UTC.
|
DateTimeFormatterBuilder |
appendTimeZoneOffset(java.lang.String zeroOffsetPrintText,
java.lang.String zeroOffsetParseText,
boolean showSeparators,
int minFields,
int maxFields)
Instructs the printer to emit text and numbers to display time zone
offset from UTC.
|
DateTimeFormatterBuilder |
appendTimeZoneShortName()
Instructs the printer to emit a short locale-specific time zone name.
|
DateTimeFormatterBuilder |
appendTimeZoneShortName(java.util.Map<java.lang.String,DateTimeZone> parseLookup)
Instructs the printer to emit a short locale-specific time zone
name, providing a lookup for parsing.
|
DateTimeFormatterBuilder |
appendTwoDigitWeekyear(int pivot)
Instructs the printer to emit a numeric weekyear field which always prints
and parses two digits.
|
DateTimeFormatterBuilder |
appendTwoDigitWeekyear(int pivot,
boolean lenientParse)
Instructs the printer to emit a numeric weekyear field which always prints
two digits.
|
DateTimeFormatterBuilder |
appendTwoDigitYear(int pivot)
Instructs the printer to emit a numeric year field which always prints
and parses two digits.
|
DateTimeFormatterBuilder |
appendTwoDigitYear(int pivot,
boolean lenientParse)
Instructs the printer to emit a numeric year field which always prints
two digits.
|
DateTimeFormatterBuilder |
appendWeekOfWeekyear(int minDigits)
Instructs the printer to emit a numeric weekOfWeekyear field.
|
DateTimeFormatterBuilder |
appendWeekyear(int minDigits,
int maxDigits)
Instructs the printer to emit a numeric weekyear field.
|
DateTimeFormatterBuilder |
appendYear(int minDigits,
int maxDigits)
Instructs the printer to emit a numeric year field.
|
DateTimeFormatterBuilder |
appendYearOfCentury(int minDigits,
int maxDigits)
Instructs the printer to emit a numeric year of century field.
|
DateTimeFormatterBuilder |
appendYearOfEra(int minDigits,
int maxDigits)
Instructs the printer to emit a numeric yearOfEra field.
|
boolean |
canBuildFormatter()
Returns true if toFormatter can be called without throwing an
UnsupportedOperationException.
|
boolean |
canBuildParser()
Returns true if toParser can be called without throwing an
UnsupportedOperationException.
|
boolean |
canBuildPrinter()
Returns true if toPrinter can be called without throwing an
UnsupportedOperationException.
|
void |
clear()
Clears out all the appended elements, allowing this builder to be
reused.
|
DateTimeFormatter |
toFormatter()
Constructs a DateTimeFormatter using all the appended elements.
|
DateTimeParser |
toParser()
Internal method to create a DateTimeParser instance using all the
appended elements.
|
DateTimePrinter |
toPrinter()
Internal method to create a DateTimePrinter instance using all the
appended elements.
|
public DateTimeFormatterBuilder()
public DateTimeFormatter toFormatter()
This is the main method used by applications at the end of the build process to create a usable formatter.
Subsequent changes to this builder do not affect the returned formatter.
The returned formatter may not support both printing and parsing.
The methods DateTimeFormatter.isPrinter()
and
DateTimeFormatter.isParser()
will help you determine the state
of the formatter.
java.lang.UnsupportedOperationException
- if neither printing nor parsing is supportedpublic DateTimePrinter toPrinter()
Most applications will not use this method.
If you want a printer in an application, call toFormatter()
and just use the printing API.
Subsequent changes to this builder do not affect the returned printer.
java.lang.UnsupportedOperationException
- if printing is not supportedpublic DateTimeParser toParser()
Most applications will not use this method.
If you want a parser in an application, call toFormatter()
and just use the parsing API.
Subsequent changes to this builder do not affect the returned parser.
java.lang.UnsupportedOperationException
- if parsing is not supportedpublic boolean canBuildFormatter()
public boolean canBuildPrinter()
public boolean canBuildParser()
public void clear()
public DateTimeFormatterBuilder append(DateTimeFormatter formatter)
This extracts the underlying printer and parser and appends them The printer and parser interfaces are the low-level part of the formatting API. Normally, instances are extracted from another formatter. Note however that any formatter specific information, such as the locale, time-zone, chronology, offset parsing or pivot/default year, will not be extracted by this method.
formatter
- the formatter to addjava.lang.IllegalArgumentException
- if formatter is null or of an invalid typepublic DateTimeFormatterBuilder append(DateTimePrinter printer)
The printer interface is part of the low-level part of the formatting API. Normally, instances are extracted from another formatter. Note however that any formatter specific information, such as the locale, time-zone, chronology, offset parsing or pivot/default year, will not be extracted by this method.
printer
- the printer to add, not nulljava.lang.IllegalArgumentException
- if printer is null or of an invalid typepublic DateTimeFormatterBuilder append(DateTimeParser parser)
The parser interface is part of the low-level part of the formatting API. Normally, instances are extracted from another formatter. Note however that any formatter specific information, such as the locale, time-zone, chronology, offset parsing or pivot/default year, will not be extracted by this method.
parser
- the parser to add, not nulljava.lang.IllegalArgumentException
- if parser is null or of an invalid typepublic DateTimeFormatterBuilder append(DateTimePrinter printer, DateTimeParser parser)
The printer and parser interfaces are the low-level part of the formatting API. Normally, instances are extracted from another formatter. Note however that any formatter specific information, such as the locale, time-zone, chronology, offset parsing or pivot/default year, will not be extracted by this method.
printer
- the printer to add, not nullparser
- the parser to add, not nulljava.lang.IllegalArgumentException
- if printer or parser is null or of an invalid typepublic DateTimeFormatterBuilder append(DateTimePrinter printer, DateTimeParser[] parsers)
Only the printer is optional. In addition, it is illegal for any but the last of the parser array elements to be null. If the last element is null, this represents the empty parser. The presence of an empty parser indicates that the entire array of parse formats is optional.
The printer and parser interfaces are the low-level part of the formatting API. Normally, instances are extracted from another formatter. Note however that any formatter specific information, such as the locale, time-zone, chronology, offset parsing or pivot/default year, will not be extracted by this method.
printer
- the printer to addparsers
- the parsers to addjava.lang.IllegalArgumentException
- if any printer or parser is of an invalid typejava.lang.IllegalArgumentException
- if any parser element but the last is nullpublic DateTimeFormatterBuilder appendOptional(DateTimeParser parser)
The parser interface is part of the low-level part of the formatting API. Normally, instances are extracted from another formatter. Note however that any formatter specific information, such as the locale, time-zone, chronology, offset parsing or pivot/default year, will not be extracted by this method.
java.lang.IllegalArgumentException
- if parser is null or of an invalid typepublic DateTimeFormatterBuilder appendLiteral(char c)
public DateTimeFormatterBuilder appendLiteral(java.lang.String text)
java.lang.IllegalArgumentException
- if text is nullpublic DateTimeFormatterBuilder appendDecimal(DateTimeFieldType fieldType, int minDigits, int maxDigits)
fieldType
- type of field to appendminDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to parse, or the estimated
maximum number of digits to printjava.lang.IllegalArgumentException
- if field type is nullpublic DateTimeFormatterBuilder appendFixedDecimal(DateTimeFieldType fieldType, int numDigits)
fieldType
- type of field to appendnumDigits
- the exact number of digits to parse or print, except if
printed value requires more digitsjava.lang.IllegalArgumentException
- if field type is null or if numDigits <= 0
public DateTimeFormatterBuilder appendSignedDecimal(DateTimeFieldType fieldType, int minDigits, int maxDigits)
fieldType
- type of field to appendminDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to parse, or the estimated
maximum number of digits to printjava.lang.IllegalArgumentException
- if field type is nullpublic DateTimeFormatterBuilder appendFixedSignedDecimal(DateTimeFieldType fieldType, int numDigits)
fieldType
- type of field to appendnumDigits
- the exact number of digits to parse or print, except if
printed value requires more digitsjava.lang.IllegalArgumentException
- if field type is null or if numDigits <= 0
public DateTimeFormatterBuilder appendText(DateTimeFieldType fieldType)
fieldType
- type of field to appendjava.lang.IllegalArgumentException
- if field type is nullpublic DateTimeFormatterBuilder appendShortText(DateTimeFieldType fieldType)
fieldType
- type of field to appendjava.lang.IllegalArgumentException
- if field type is nullpublic DateTimeFormatterBuilder appendFraction(DateTimeFieldType fieldType, int minDigits, int maxDigits)
fieldType
- type of field to appendminDigits
- minimum number of digits to print.maxDigits
- maximum number of digits to print or parse.java.lang.IllegalArgumentException
- if field type is nullpublic DateTimeFormatterBuilder appendFractionOfSecond(int minDigits, int maxDigits)
This reliably handles the case where fractional digits are being handled
beyond a visible decimal point. The digits parsed will always be treated
as the most significant (numerically largest) digits.
Thus '23' will be parsed as 230 milliseconds.
Contrast this behaviour to appendMillisOfSecond(int)
.
This method does not print or parse the decimal point itself.
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to print or parsepublic DateTimeFormatterBuilder appendFractionOfMinute(int minDigits, int maxDigits)
This reliably handles the case where fractional digits are being handled beyond a visible decimal point. The digits parsed will always be treated as the most significant (numerically largest) digits. Thus '23' will be parsed as 0.23 minutes (converted to milliseconds). This method does not print or parse the decimal point itself.
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to print or parsepublic DateTimeFormatterBuilder appendFractionOfHour(int minDigits, int maxDigits)
This reliably handles the case where fractional digits are being handled beyond a visible decimal point. The digits parsed will always be treated as the most significant (numerically largest) digits. Thus '23' will be parsed as 0.23 hours (converted to milliseconds). This method does not print or parse the decimal point itself.
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to print or parsepublic DateTimeFormatterBuilder appendFractionOfDay(int minDigits, int maxDigits)
This reliably handles the case where fractional digits are being handled beyond a visible decimal point. The digits parsed will always be treated as the most significant (numerically largest) digits. Thus '23' will be parsed as 0.23 days (converted to milliseconds). This method does not print or parse the decimal point itself.
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to print or parsepublic DateTimeFormatterBuilder appendMillisOfSecond(int minDigits)
This method will append a field that prints a three digit value.
During parsing the value that is parsed is assumed to be three digits.
If less than three digits are present then they will be counted as the
smallest parts of the millisecond. This is probably not what you want
if you are using the field as a fraction. Instead, a fractional
millisecond should be produced using appendFractionOfSecond(int, int)
.
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendMillisOfDay(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendSecondOfMinute(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendSecondOfDay(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendMinuteOfHour(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendMinuteOfDay(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendHourOfDay(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendClockhourOfDay(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendHourOfHalfday(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendClockhourOfHalfday(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendDayOfWeek(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendDayOfMonth(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendDayOfYear(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendWeekOfWeekyear(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendWeekyear(int minDigits, int maxDigits)
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to parse, or the estimated
maximum number of digits to printpublic DateTimeFormatterBuilder appendMonthOfYear(int minDigits)
minDigits
- minimum number of digits to printpublic DateTimeFormatterBuilder appendYear(int minDigits, int maxDigits)
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to parse, or the estimated
maximum number of digits to printpublic DateTimeFormatterBuilder appendTwoDigitYear(int pivot)
(pivot - 50) .. (pivot + 49)
.
pivot supported range 00 is 20 is 40 is 60 is 80 is --------------------------------------------------------------- 1950 1900..1999 1900 1920 1940 1960 1980 1975 1925..2024 2000 2020 1940 1960 1980 2000 1950..2049 2000 2020 2040 1960 1980 2025 1975..2074 2000 2020 2040 2060 1980 2050 2000..2099 2000 2020 2040 2060 2080
pivot
- pivot year to use when parsingpublic DateTimeFormatterBuilder appendTwoDigitYear(int pivot, boolean lenientParse)
(pivot - 50) .. (pivot + 49)
. If
parse is instructed to be lenient and the digit count is not two, it is
treated as an absolute year. With lenient parsing, specifying a positive
or negative sign before the year also makes it absolute.pivot
- pivot year to use when parsinglenientParse
- when true, if digit count is not two, it is treated
as an absolute yearpublic DateTimeFormatterBuilder appendTwoDigitWeekyear(int pivot)
(pivot - 50) .. (pivot + 49)
.
pivot supported range 00 is 20 is 40 is 60 is 80 is --------------------------------------------------------------- 1950 1900..1999 1900 1920 1940 1960 1980 1975 1925..2024 2000 2020 1940 1960 1980 2000 1950..2049 2000 2020 2040 1960 1980 2025 1975..2074 2000 2020 2040 2060 1980 2050 2000..2099 2000 2020 2040 2060 2080
pivot
- pivot weekyear to use when parsingpublic DateTimeFormatterBuilder appendTwoDigitWeekyear(int pivot, boolean lenientParse)
(pivot - 50) .. (pivot + 49)
. If
parse is instructed to be lenient and the digit count is not two, it is
treated as an absolute weekyear. With lenient parsing, specifying a positive
or negative sign before the weekyear also makes it absolute.pivot
- pivot weekyear to use when parsinglenientParse
- when true, if digit count is not two, it is treated
as an absolute weekyearpublic DateTimeFormatterBuilder appendYearOfEra(int minDigits, int maxDigits)
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to parse, or the estimated
maximum number of digits to printpublic DateTimeFormatterBuilder appendYearOfCentury(int minDigits, int maxDigits)
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to parse, or the estimated
maximum number of digits to printpublic DateTimeFormatterBuilder appendCenturyOfEra(int minDigits, int maxDigits)
minDigits
- minimum number of digits to printmaxDigits
- maximum number of digits to parse, or the estimated
maximum number of digits to printpublic DateTimeFormatterBuilder appendHalfdayOfDayText()
public DateTimeFormatterBuilder appendDayOfWeekText()
public DateTimeFormatterBuilder appendDayOfWeekShortText()
public DateTimeFormatterBuilder appendMonthOfYearText()
public DateTimeFormatterBuilder appendMonthOfYearShortText()
public DateTimeFormatterBuilder appendEraText()
public DateTimeFormatterBuilder appendTimeZoneName()
appendTimeZoneName(Map)
.public DateTimeFormatterBuilder appendTimeZoneName(java.util.Map<java.lang.String,DateTimeZone> parseLookup)
LinkedHashMap
or similar.parseLookup
- the table of names, not nullpublic DateTimeFormatterBuilder appendTimeZoneShortName()
appendTimeZoneShortName(Map)
.public DateTimeFormatterBuilder appendTimeZoneShortName(java.util.Map<java.lang.String,DateTimeZone> parseLookup)
LinkedHashMap
or similar.parseLookup
- the table of names, null to use the default names
public DateTimeFormatterBuilder appendTimeZoneId()
public DateTimeFormatterBuilder appendTimeZoneOffset(java.lang.String zeroOffsetText, boolean showSeparators, int minFields, int maxFields)
If zero offset text is supplied, then it will be printed when the zone is zero. During parsing, either the zero offset text, or the offset will be parsed.
zeroOffsetText
- the text to use if time zone offset is zero. If
null, offset is always shown.showSeparators
- if true, prints ':' separator before minute and
second field and prints '.' separator before fraction field.minFields
- minimum number of fields to print, stopping when no
more precision is required. 1=hours, 2=minutes, 3=seconds, 4=fractionmaxFields
- maximum number of fields to printpublic DateTimeFormatterBuilder appendTimeZoneOffset(java.lang.String zeroOffsetPrintText, java.lang.String zeroOffsetParseText, boolean showSeparators, int minFields, int maxFields)
If zero offset print text is supplied, then it will be printed when the zone is zero. If zero offset parse text is supplied, then either it or the offset will be parsed.
zeroOffsetPrintText
- the text to print if time zone offset is zero. If
null, offset is always shown.zeroOffsetParseText
- the text to optionally parse to indicate that the time
zone offset is zero. If null, then always use the offset.showSeparators
- if true, prints ':' separator before minute and
second field and prints '.' separator before fraction field.minFields
- minimum number of fields to print, stopping when no
more precision is required. 1=hours, 2=minutes, 3=seconds, 4=fractionmaxFields
- maximum number of fields to printpublic DateTimeFormatterBuilder appendPattern(java.lang.String pattern)
DateTimeFormat
to parse the pattern and append the
results into this builder.pattern
- pattern specificationjava.lang.IllegalArgumentException
- if the pattern is invalidDateTimeFormat
Copyright © 2010 - 2020 Adobe. All Rights Reserved