ICU Enhancement
This class is ICU's replacement for java..
ICU
Methods, fields, and other functionality specific to ICU are labeled 'ICU'.
DateFormatSymbols is a public class for encapsulating
localizable date-time formatting data, such as the names of the
months, the names of the days of the week, and the time zone data.
DateFormat and SimpleDateFormat both use
DateFormatSymbols to encapsulate this information.
Typically you shouldn't use DateFormatSymbols directly.
Rather, you are encouraged to create a date-time formatter with the
DateFormat class's factory methods: getTimeInstance,
getDateInstance, or getDateTimeInstance.
These methods automatically create a DateFormatSymbols for
the formatter so that you don't have to. After the
formatter is created, you may modify its format pattern using the
setPattern method. For more information about
creating formatters using DateFormat's factory methods,
see DateFormat.
If you decide to create a date-time formatter with a specific format pattern for a specific locale, you can do so with:
new SimpleDateFormat(aPattern, new DateFormatSymbols(aLocale)).
DateFormatSymbols objects are clonable. When you obtain
a DateFormatSymbols object, feel free to modify the
date-time formatting data. For instance, you can replace the localized
date-time format pattern characters with the ones that you feel easy
to remember. Or you can change the representative cities
to your favorite ones.
New DateFormatSymbols subclasses may be added to support
SimpleDateFormat for date-time formatting for additional locales.
DateFormat, SimpleDateFormat, com.ibm.icu.util.SimpleTimeZone
| Modifier and Type | Class and Description |
|---|---|
| private static class | DateFormatSymbols.CalendarDataSink
Sink to enumerate the calendar data |
| pack-priv static enum |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ABBREVIATED
ICU |
| pack-priv String[] | abbreviatedDayPeriods
Localized names for abbreviated (== short) day periods. |
| private ULocale | actualLocale
The locale containing data used to construct this object, or null. |
| pack-priv static final String | |
| pack-priv String[] | ampms
AM and PM strings. |
| pack-priv String[] | ampmsNarrow
narrow AM and PM strings. |
| private static final String[][] | |
| pack-priv Map | capitalization
Capitalization transforms. |
| private static final Map | contextUsageTypeMap
Map from resource key to CapitalizationContextUsage value |
| private static final String[] | DAY_PERIOD_KEYS
Keys for dayPeriods |
| pack-priv static final String | |
| private static CacheBase | |
| public static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| public static final int | |
| pack-priv String[] | eraNames
Era name strings. |
| pack-priv String[] | eras
Era strings. |
| public static final int | FORMAT
ICU |
| private static final String[] | LEAP_MONTH_PATTERNS_PATHS
Resource bundle paths for each leap month pattern |
| pack-priv String[] | leapMonthPatterns
All leap month patterns, for example "{0}bis". |
| pack-priv String | localPatternChars
Localized date-time pattern characters. |
| pack-priv static final int | millisPerHour
Useful constant for defining timezone offsets. |
| pack-priv String[] | months
Month strings. |
| public static final int | NARROW
ICU |
| pack-priv String[] | narrowDayPeriods
Localized names for narrow day periods. |
| pack-priv String[] | narrowEras
Narrow era names. |
| pack-priv String[] | narrowMonths
Narrow month strings. |
| pack-priv String[] | narrowQuarters
Narrow quarter names. |
| pack-priv String[] | narrowWeekdays
CLDR-style format narrow weekday strings, for example: "S", "M", etc.
An array of 8 strings, indexed by |
| public static final int | NUMERIC
ICU |
| pack-priv static final String | patternChars
Unlocalized date-time pattern characters. |
| pack-priv String[] | quarters
Full quarter names. |
| private ULocale | |
| private static final long | |
| public static final int | SHORT
ICU |
| pack-priv String[] | shorterWeekdays
CLDR-style format short weekday strings, for example: "Su", "Mo", etc.
An array of 8 strings, indexed by |
| pack-priv String[] | shortMonths
Short month strings. |
| pack-priv String[] | shortQuarters
Abbreviated quarter names. |
| pack-priv String[] | shortWeekdays
CLDR-style format abbreviated (not short) weekday strings,
for example: "Sun", "Mon", etc.
An array of 8 strings, indexed by |
| pack-priv String[] | shortYearNames
Cyclic year names, for example: "jia-zi", "yi-chou", ... |
| pack-priv String[] | shortZodiacNames
Cyclic zodiac names, for example: "Rat", "Ox", "Tiger", etc. An array of (normally) 12 strings. |
| public static final int | STANDALONE
ICU |
| pack-priv String[] | standaloneAbbreviatedDayPeriods
Localized names for standalone abbreviated (== short) day periods. |
| pack-priv String[] | standaloneMonths
Standalone month strings. |
| pack-priv String[] | standaloneNarrowDayPeriods
Localized names for standalone narrow day periods. |
| pack-priv String[] | standaloneNarrowMonths
Standalone narrow month strings. |
| pack-priv String[] | standaloneNarrowQuarters
Standalone narrow quarter names. |
| pack-priv String[] | standaloneNarrowWeekdays
Standalone narrow weekday strings. |
| pack-priv String[] | standaloneQuarters
Standalone full quarter names. |
| pack-priv String[] | standaloneShorterWeekdays
CLDR-style standalone short weekday strings, for example: "Sun", "Mon", etc.
An array of 8 strings, indexed by |
| pack-priv String[] | standaloneShortMonths
Standalone short month strings. |
| pack-priv String[] | standaloneShortQuarters
Standalone abbreviated quarter names. |
| pack-priv String[] | standaloneShortWeekdays
CLDR-style standalone abbreviated (not short) weekday strings,
for example: "Sun", "Mon", etc.
An array of 8 strings, indexed by |
| pack-priv String[] | standaloneWeekdays
Standalone wide weekday strings. |
| pack-priv String[] | standaloneWideDayPeriods
Localized names for standalone wide day periods. |
| private String | timeSeparator
Time separator string. |
| private ULocale | validLocale
The most specific locale containing any resource data, or null. |
| pack-priv String[] | weekdays
Format wide weekday strings, for example: "Sunday", "Monday", etc.
An array of 8 strings, indexed by |
| public static final int | WIDE
ICU |
| pack-priv String[] | wideDayPeriods
Localized names for wide day periods. |
| private String[][] | zoneStrings
Localized names of time zones in this locale. |
| Access | Constructor and Description |
|---|---|
| public | DateFormatSymbols()
Constructs a DateFormatSymbols object by loading format data from
resources for the default |
| public | DateFormatSymbols(Locale locale)
Constructs a DateFormatSymbols object by loading format data from resources for the given locale. |
| public | |
| private | DateFormatSymbols(ULocale desiredLocale, ICUResourceBundle b, String calendarType)
Private, for cache.getInstance(). |
| public | DateFormatSymbols(Calendar
The calendar system whose date format symbols are desired. cal, Locale The locale whose symbols are desired. locale)Returns the |
| public | DateFormatSymbols(Calendar
The calendar system whose date format symbols are desired. cal, ULocale The ulocale whose symbols are desired. locale)Returns the |
| public | DateFormatSymbols(Class<? extends Calendar> calendarClass, Locale locale)
Variant of DateFormatSymbols(Calendar, Locale) that takes the Calendar class instead of a Calendar instance. |
| public | DateFormatSymbols(Class<? extends Calendar> calendarClass, ULocale locale)
Variant of DateFormatSymbols(Calendar, ULocale) that takes the Calendar class instead of a Calendar instance. |
| public | DateFormatSymbols(ResourceBundle bundle, Locale locale)
Fetches a custom calendar's DateFormatSymbols out of the given resource bundle. |
| public | DateFormatSymbols(ResourceBundle bundle, ULocale locale)
Fetches a custom calendar's DateFormatSymbols out of the given resource bundle. |
| Modifier and Type | Method and Description |
|---|---|
| private static final boolean | |
| public Object | |
| private final String[] | |
| private final String[][] | |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. |
| public String[] | |
| public static Locale[] | Returns: An array ofLocales for which localized
DateFormatSymbols instances are available.Returns an array of all locales for which the |
| public static ULocale[] | Returns: An array ofULocales for which localized
DateFormatSymbols instances are available.ICU |
| public static ResourceBundle | getDateFormatBundle(Class<? extends Calendar> calendarClass, Locale locale)
Deprecated
ICU 4.0
Finds the ResourceBundle containing the date format information for
a specified calendar subclass in a given locale.
|
| public static ResourceBundle | getDateFormatBundle(Class<? extends Calendar> calendarClass, ULocale locale)
Deprecated
ICU 4.0
Finds the ResourceBundle containing the date format information for
a specified calendar subclass in a given locale.
|
| public static ResourceBundle | getDateFormatBundle(Calendar cal, Locale locale)
Deprecated
ICU 4.0
Variant of getDateFormatBundle(java.lang.Class, java.util.Locale) that takes
a Calendar instance instead of a Calendar class.
|
| public static ResourceBundle | getDateFormatBundle(Calendar cal, ULocale locale)
Deprecated
ICU 4.0
Variant of getDateFormatBundle(java.lang.Class, java.util.Locale) that takes
a Calendar instance instead of a Calendar class.
|
| public String[] | |
| public String[] | |
| public static DateFormatSymbols | Returns: A DateFormatSymbols instance.Returns a DateFormatSymbols instance for the default locale. |
| public static DateFormatSymbols | Returns: A DateFormatSymbols instance.the locale. locale)Returns a DateFormatSymbols instance for the given locale. |
| public static DateFormatSymbols | |
| public String | Returns: The leapMonthPattern, or null if not available for this calendar.The usage context: FORMAT, STANDALONE, NUMERIC. context, int The requested pattern width: WIDE, ABBREVIATED, SHORT, NARROW. width)
Deprecated
This API is ICU internal only.
Returns the appropriate leapMonthPattern if the calendar has them,
for example: "{0}bis"
|
| public final ULocale | Returns: the information specified by type, or null if this object was not constructed from locale data.type of information requested, either typecom. or com..Returns the locale that was used to create this object, or null. |
| public String | Returns: the localized date-time pattern characters.Returns localized date-time pattern characters. |
| public String[] | |
| public String[] | Returns: the month strings.The month context, FORMAT or STANDALONE. context, int The width or the returned month string,
either WIDE, ABBREVIATED, or NARROW. width)Returns month strings. |
| public String[] | |
| public String[] | Returns: the quarter strings.The quarter context, FORMAT or STANDALONE. context, int The width or the returned quarter string,
WIDE, NARROW, or ABBREVIATED. width)ICU |
| public String[] | |
| public String[] | Returns: the abbreviated weekday strings. UseCalendar.SUNDAY,
Calendar.MONDAY, etc. to index the result array.Returns abbreviated weekday strings; for example: "Sun", "Mon", etc. (Note: the method name is misleading; it does not get the CLDR-style "short" weekday strings, e.g. "Su", "Mo", etc.) |
| public String | Returns: the time separator string.
Deprecated
This API is ICU internal only.
Returns the time separator string.
|
| public String[] | Returns: the weekday strings. UseCalendar.SUNDAY,
Calendar.MONDAY, etc. to index the result array.Returns wide weekday strings. |
| public String[] | Returns: the weekday strings. UseCalendar.SUNDAY,
Calendar.MONDAY, etc. to index the result array.Formatting context, either FORMAT or STANDALONE. context, int Width of strings to be returned, either
WIDE, ABBREVIATED, SHORT, or NARROW width)Returns weekday strings. |
| public String[] | Returns: The year name strings, or null if they are not available for this calendar.The usage context: FORMAT, STANDALONE. context, int The requested name width: WIDE, ABBREVIATED, SHORT, NARROW. width)Returns cyclic year name strings if the calendar has them, for example: "jia-zi", "yi-chou", etc. |
| public String[] | Returns: The zodiac name strings, or null if they are not available for this calendar.The usage context: FORMAT, STANDALONE. context, int The requested name width: WIDE, ABBREVIATED, SHORT, NARROW. width)Returns calendar zodiac name strings if the calendar has them, for example: "Rat", "Ox", "Tiger", etc. |
| public String[][] | |
| public int | |
| protected void | initializeData(ULocale
The locale whose symbols are desired. desiredLocale, String The calendar type whose date format symbols are desired. type)Initializes format symbols for the locale and calendar type |
| pack-priv void | |
| protected void | initializeData(ULocale
The locale whose symbols are desired. desiredLocale, ICUResourceBundle Resource bundle provided externally b, String The calendar type being used calendarType)
Deprecated
This API is ICU internal only.
Initializes format symbols for the locale and calendar type
|
| private String[] | loadDayPeriodStrings(Map<String, String>
Contains the dayPeriod resource to load resourceMap, String[] If non-null, any values in the result that would otherwise be null are copied
from this array copyFrom)Loads localized names for day periods in the requested format. |
| private void | readObject(ObjectInputStream stream)
3.8 or older version did not have localized GMT format patterns. |
| public void | |
| public void | |
| public void | |
| public void | setLeapMonthPattern(String
The new leapMonthPattern. leapMonthPattern, int The usage context: FORMAT, STANDALONE, NUMERIC. context, int The name width: WIDE, ABBREVIATED, NARROW. width)
Deprecated
This API is ICU internal only.
Sets a leapMonthPattern, for example: "{0}bis"
|
| pack-priv final void | |
| public void | setLocalPatternChars(String
the new localized date-time
pattern characters. newLocalPatternChars)Sets localized date-time pattern characters. |
| public void | |
| public void | |
| public void | |
| public void | setQuarters(String[]
the new quarter strings. newQuarters, int The formatting context, FORMAT or STANDALONE. context, int The width of the quarter string,
WIDE, NARROW, or ABBREVIATED. width)ICU |
| public void | |
| public void | setShortWeekdays(String[]
the new abbreviated weekday strings. The array should
be indexed by newAbbrevWeekdays)Calendar.SUNDAY,
Calendar.MONDAY, etc.Sets abbreviated weekday strings; for example: "Sun", "Mon", etc. (Note: the method name is misleading; it does not set the CLDR-style "short" weekday strings, e.g. "Su", "Mo", etc.) |
| public void | setTimeSeparatorString(String
the new time separator string. newTimeSeparator)
Deprecated
This API is ICU internal only.
Sets the time separator string.
|
| public void | setWeekdays(String[]
The new weekday strings. newWeekdays, int The formatting context, FORMAT or STANDALONE. context, int The width of the strings,
either WIDE, ABBREVIATED, SHORT, or NARROW. width)Sets weekday strings. |
| public void | setWeekdays(String[]
the new weekday strings. The array should
be indexed by newWeekdays)Calendar.SUNDAY,
Calendar.MONDAY, etc.Sets wide weekday strings. |
| public void | setYearNames(String[]
The new cyclic year name strings. yearNames, int The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). context, int The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported). width)Sets cyclic year name strings, for example: "jia-zi", "yi-chou", etc. |
| public void | setZodiacNames(String[]
The new zodiac name strings. zodiacNames, int The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). context, int The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported). width)Sets calendar zodiac name strings, for example: "Rat", "Ox", "Tiger", etc. |
| public void |