Package org.linkki.util
Class DateFormats
java.lang.Object
org.linkki.util.DateFormats
A registry for date format patterns that changes some rather unsuitable default patterns provided
by
DateFormat.getDateInstance(int, Locale) such as the German "dd.MM.yyyy" instead of
"dd.MM.yy".
The date pattern for a given locale is determined using the following order:
- Registered patterns for the locale
- Registered patterns for the language
- The
short date patternobtained from the JDK - The ISO date pattern
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetPattern(Locale locale) Returns the date pattern for the given locale.static voidRegisters the given pattern for the given language.static voidRegisters the given pattern for the given locale.
-
Field Details
-
PATTERN_ISO
- See Also:
-
PATTERN_EN
- See Also:
-
PATTERN_DE
- See Also:
-
PATTERN_EN_US
- See Also:
-
PATTERN_EN_GB
- See Also:
-
-
Method Details
-
register
Registers the given pattern for the given language. The language pattern is used as a fallback if no pattern has been explicitly defined for a locale.To register a pattern for a specific locale use
register(Locale, String).- Parameters:
languageCode- a ISO 639 language code, as obtainable fromLocale.getLanguage()pattern- a pattern forDateTimeFormatter
-
register
Registers the given pattern for the given locale.To register a pattern for a language use
register(String, String).- Parameters:
locale- the localepattern- a pattern forDateTimeFormatter
-
getPattern
Returns the date pattern for the given locale. It is determined using the following order:- Registered patterns for the locale
- Registered patterns for the language
- The
short date patternobtained from the JDK - The ISO date pattern
-