Datetime formatting is performed by the {@link DateTimeFormatter} class.Three classes provide factory methods to create formatters, and this is one. The others are {@link DateTimeFormat} and {@link 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. @author Brian S O'Neill @author Stephen Colebourne @author Fredrik Borgh @since 1.0 @see DateTimeFormat @see ISODateTimeFormat
This allows a {@code DateTimeFormatter} to be created.All date-time formatters are created ultimately using this builder.
The basic elements of date-time can all be added:
Finally, a shorthand pattern, mostly compatible with {@code java.text.SimpleDateFormat SimpleDateFormat}can be used, see {@link #appendPattern(String)}. In practice, this simply parses the pattern and calls other methods on the builder. @implSpec This class is a mutable builder intended for use from a single thread. @since 1.8
All date-time formatters are created ultimately using this builder. Each consists of two halves a {@link DateTimePrinter printer} and a {@link DateTimeParser parser}. Most of the methods will create both a printer and a parser automatically, however it is possible to create a formatter that only prints or only parses.
The basic elements of calendricals can all be added:
Finally, a shorthand pattern, mostly compatible with {@code SimpleDateFormat}can be used, see {@link #appendPattern(String)}. In practice, this simply parses the pattern and calls other methods on the builder. @author Stephen Colebourne
Datetime formatting is performed by the {@link DateTimeFormatter} class.Three classes provide factory methods to create formatters, and this is one. The others are {@link DateTimeFormat} and {@link 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. @author Brian S O'Neill @author Stephen Colebourne @author Fredrik Borgh @since 1.0 @see DateTimeFormat @see ISODateTimeFormat
Datetime formatting is performed by the {@link DateTimeFormatter} class.Three classes provide factory methods to create formatters, and this is one. The others are {@link DateTimeFormat} and {@link 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. @author Brian S O'Neill @author Stephen Colebourne @author Fredrik Borgh @since 1.0 @see DateTimeFormat @see ISODateTimeFormat
This allows a {@code DateTimeFormatter} to be created.All date-time formatters are created ultimately using this builder.
The basic elements of date-time can all be added:
In addition, any of the elements may be decorated by padding, either with spaces or any other character.
Finally, a shorthand pattern, mostly compatible with {@code java.text.SimpleDateFormat SimpleDateFormat}can be used, see {@link #appendPattern(String)}. In practice, this simply parses the pattern and calls other methods on the builder.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|