public class DateTimeFormats extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
add(Locale locale,
String format)
Adds the specified format to the list of recognised date-time formats.
|
static List<DateTimeFormatter> |
get()
Returns all known date-time formats as an
unmodifiableList of
DateTimeFormatter s. |
static Optional<DateTimeFormatter> |
remove(int index)
Removes the specified format from the list of recognized date-time formats,
if it exists.
|
static List<String> |
strings()
Returns all known date-time formats as an
unmodifiableList of
String s. |
public static List<DateTimeFormatter> get()
unmodifiableList
of
DateTimeFormatter
s.unmodifiableList
of
DateTimeFormatter
s.public static List<String> strings()
unmodifiableList
of
String
s.unmodifiableList
of
String
s.public static boolean add(Locale locale, String format)
locale
must be a valid Locale
, e.g. "en_US".
format
must be a valid DateTimeFormatter
-styled
date-time format, e.g. "MM/dd/yyyy HH:mm".
public static Optional<DateTimeFormatter> remove(int index)
Formats are removed according to their indices. Note that the first
format is at index 0
, which means that, for a list of N
formats, the last format has index N-1
.
The formats returned from get()
and strings()
are
returned in order, by their indices.
index
- index of the date-time format to removeDateTimeFormatter
object, wrapped
in an Optional
; returns an empty Optional
if the index is
out of range.strings() returns an ordered list of the
currently-recognized date-time formats
Copyright © 2019 NIBRT. All rights reserved.