Appends a localized date-time pattern to the formatter.
This appends a localized section to the builder, suitable for outputting a date, time or date-time combination. The format of the localized section is lazily looked up based on four items:
dateStyle
specified to this method
timeStyle
specified to this method
Locale
of the DateTimeFormatter
Chronology
, selecting the best available
DateTimeFormatter.withChronology(Chronology)
.
The FULL
and LONG
styles typically require a time-zone.
When formatting using these styles, a ZoneId
must be available,
either by using ZonedDateTime
or DateTimeFormatter.withZone
.
During parsing, if a chronology has already been parsed, then it is used.
Otherwise the default from DateTimeFormatter.withChronology(Chronology)
is used, with IsoChronology
as the fallback.
Note that this method provides similar functionality to methods on
DateFormat
such as java.text.DateFormat.getDateTimeInstance(int, int)
.
dateStyle | the date style to use, null means no date required | |
timeStyle | the time style to use, null means no time required |
IllegalArgumentException | if both the date and time styles are null |
Diagram: Format