@Immutable public final class PDTFormatter extends Object
DateTimeFormatter objects used for printing and parsing
date and time objects.| Modifier and Type | Class and Description |
|---|---|
static class |
PDTFormatter.CacheKey
Internal cache key for
PDTFormatter.LocalizedDateFormatCache. |
static class |
PDTFormatter.LocalizedDateFormatCache
This class caches the compiled patterns for localized date and time
formatter.
|
| Modifier and Type | Field and Description |
|---|---|
static FormatStyle |
DEFAULT_STYLE
By default the medium style is used
|
| Modifier and Type | Method and Description |
|---|---|
static DateTimeFormatter |
getFormatterDate(FormatStyle eStyle,
Locale aDisplayLocale,
EDTFormatterMode eMode)
Get the date formatter for the passed locale.
|
static DateTimeFormatter |
getFormatterDateTime(FormatStyle eStyle,
Locale aDisplayLocale,
EDTFormatterMode eMode)
Get the date time formatter for the passed locale.
|
static DateTimeFormatter |
getFormatterTime(FormatStyle eStyle,
Locale aDisplayLocale,
EDTFormatterMode eMode)
Get the time formatter for the passed locale.
|
static DateTimeFormatter |
getForPattern(String sPattern)
Get the
DateTimeFormatter for the given pattern, using our default
chronology. |
static DateTimeFormatter |
getForPattern(String sPattern,
Locale aDisplayLocale)
Get the STRICT
DateTimeFormatter for the given pattern and locale,
using our default chronology. |
static String |
getPattern(EDTType eDTType,
Locale aLocale,
FormatStyle eStyle,
EDTFormatterMode eMode) |
static DateTimeFormatter |
getWithLocale(DateTimeFormatter aFormatter,
Locale aDisplayLocale)
Assign the passed display locale to the passed date time formatter.
|
static int |
toDateStyle(FormatStyle eStyle) |
static FormatStyle |
toFormatStyle(int nStyle) |
public static final FormatStyle DEFAULT_STYLE
@Nonnull public static FormatStyle toFormatStyle(int nStyle)
public static int toDateStyle(@Nonnull FormatStyle eStyle)
@Nonnull public static String getPattern(@Nonnull EDTType eDTType, @Nullable Locale aLocale, @Nonnull FormatStyle eStyle, @Nonnull EDTFormatterMode eMode)
@Nonnull public static DateTimeFormatter getWithLocale(@Nonnull DateTimeFormatter aFormatter, @Nullable Locale aDisplayLocale)
aFormatter - The formatter to be modified. May not be null.aDisplayLocale - The display locale to be used. May be null.null.@Nonnull public static DateTimeFormatter getFormatterDate(@Nonnull FormatStyle eStyle, @Nullable Locale aDisplayLocale, @Nonnull EDTFormatterMode eMode)
eStyle - The format style to be used. May not be null.aDisplayLocale - The display locale to be used. May be null.eMode - Print or parse? May not be null.null.@Nonnull public static DateTimeFormatter getFormatterTime(@Nonnull FormatStyle eStyle, @Nullable Locale aDisplayLocale, @Nonnull EDTFormatterMode eMode)
eStyle - The format style to be used. May not be null.aDisplayLocale - The display locale to be used. May be null.eMode - Print or parse? May not be null.null.@Nonnull public static DateTimeFormatter getFormatterDateTime(@Nonnull FormatStyle eStyle, @Nullable Locale aDisplayLocale, @Nonnull EDTFormatterMode eMode)
eStyle - The format style to be used. May not be null.aDisplayLocale - The display locale to be used. May be null.eMode - Print or parse? May not be null.null.@Nonnull public static DateTimeFormatter getForPattern(@Nonnull String sPattern)
DateTimeFormatter for the given pattern, using our default
chronology.sPattern - The pattern to be parsedIllegalArgumentException - If the pattern is illegal@Nonnull public static DateTimeFormatter getForPattern(@Nonnull String sPattern, @Nullable Locale aDisplayLocale)
DateTimeFormatter for the given pattern and locale,
using our default chronology.sPattern - The pattern to be parsedaDisplayLocale - The locale to be used. May be null.IllegalArgumentException - If the pattern is illegalCopyright © 2014–2020 Philip Helger. All rights reserved.