| java.lang.Object java.text.DateFormatSymbols
DateFormatSymbols | public class DateFormatSymbols implements Serializable,Cloneable(Code) | | 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, DateFormatSymbols.getInstance(aLocale)).
DateFormatSymbols objects are cloneable. 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.
See Also: DateFormat See Also: SimpleDateFormat See Also: java.util.SimpleTimeZone version: 1.54 05/05/07 author: Chen-Lieh Huang |
Constructor Summary | |
public | DateFormatSymbols() Construct a DateFormatSymbols object by loading format data from
resources for the default locale. | public | DateFormatSymbols(Locale locale) Construct a DateFormatSymbols object by loading format data from
resources for the given locale. |
ampms | String ampms(Code) | | AM and PM strings. For example: "AM" and "PM". An array of
2 strings, indexed by Calendar.AM and
Calendar.PM .
|
eras | String eras(Code) | | Era strings. For example: "AD" and "BC". An array of 2 strings,
indexed by Calendar.BC and Calendar.AD .
|
isZoneStringsSet | transient boolean isZoneStringsSet(Code) | | Indicates that zoneStrings is set externally with setZoneStrings() method.
|
localPatternChars | String localPatternChars(Code) | | Localized date-time pattern characters. For example, a locale may
wish to use 'u' rather than 'y' to represent years in its date format
pattern strings.
This string must be exactly 18 characters long, with the index of
the characters described by DateFormat.ERA_FIELD ,
DateFormat.YEAR_FIELD , etc. Thus, if the string were
"Xz...", then localized patterns would use 'X' for era and 'z' for year.
|
locale | Locale locale(Code) | | The locale which is used for initializing this DateFormatSymbols object.
since: 1.6 |
millisPerHour | final static int millisPerHour(Code) | | Useful constant for defining time zone offsets.
|
months | String months(Code) | | Month strings. For example: "January", "February", etc. An array
of 13 strings (some calendars have 13 months), indexed by
Calendar.JANUARY , Calendar.FEBRUARY , etc.
|
patternChars | final static String patternChars(Code) | | Unlocalized date-time pattern characters. For example: 'y', 'd', etc.
All locales use the same these unlocalized pattern characters.
|
serialVersionUID | final static long serialVersionUID(Code) | | |
shortMonths | String shortMonths(Code) | | Short month strings. For example: "Jan", "Feb", etc. An array of
13 strings (some calendars have 13 months), indexed by
Calendar.JANUARY , Calendar.FEBRUARY , etc.
|
shortWeekdays | String shortWeekdays(Code) | | Short weekday strings. For example: "Sun", "Mon", etc. An array
of 8 strings, indexed by Calendar.SUNDAY ,
Calendar.MONDAY , etc.
The element shortWeekdays[0] is ignored.
|
weekdays | String weekdays(Code) | | Weekday strings. For example: "Sunday", "Monday", etc. An array
of 8 strings, indexed by Calendar.SUNDAY ,
Calendar.MONDAY , etc.
The element weekdays[0] is ignored.
|
zoneStrings | String zoneStrings(Code) | | Localized names of time zones in this locale. This is a
two-dimensional array of strings of size n by m,
where m is at least 5. Each of the n rows is an
entry containing the localized names for a single TimeZone .
Each such row contains (with i ranging from
0..n-1):
zoneStrings[i][0] - time zone ID
zoneStrings[i][1] - long name of zone in standard
time
zoneStrings[i][2] - short name of zone in
standard time
zoneStrings[i][3] - long name of zone in daylight
saving time
zoneStrings[i][4] - short name of zone in daylight
saving time
The zone ID is not localized; it's one of the valid IDs of
the
java.util.TimeZone TimeZone class that are not
custom IDs.
All other entries are localized names.
See Also: java.util.TimeZone |
equals | public boolean equals(Object obj)(Code) | | Override equals
|
getAmPmStrings | public String[] getAmPmStrings()(Code) | | Gets ampm strings. For example: "AM" and "PM".
the ampm strings. |
getAvailableLocales | public static Locale[] getAvailableLocales()(Code) | | Returns an array of all locales for which the
getInstance methods of this class can return
localized instances.
The returned array represents the union of locales supported by the
Java runtime and by installed
java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider implementations. It must contain at least a Locale
instance equal to
java.util.Locale.US Locale.US .
An array of locales for which localizedDateFormatSymbols instances are available. since: 1.6 |
getEras | public String[] getEras()(Code) | | Gets era strings. For example: "AD" and "BC".
the era strings. |
getInstance | final public static DateFormatSymbols getInstance()(Code) | | Gets the DateFormatSymbols instance for the default
locale. This method provides access to DateFormatSymbols
instances for locales supported by the Java runtime itself as well
as for those supported by installed
java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider
implementations.
a DateFormatSymbols instance. since: 1.6 |
getInstance | final public static DateFormatSymbols getInstance(Locale locale)(Code) | | Gets the DateFormatSymbols instance for the specified
locale. This method provides access to DateFormatSymbols
instances for locales supported by the Java runtime itself as well
as for those supported by installed
java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider
implementations.
Parameters: locale - the given locale. a DateFormatSymbols instance. exception: NullPointerException - if locale is null since: 1.6 |
getLocalPatternChars | public String getLocalPatternChars()(Code) | | Gets localized date-time pattern characters. For example: 'u', 't', etc.
the localized date-time pattern characters. |
getMonths | public String[] getMonths()(Code) | | Gets month strings. For example: "January", "February", etc.
the month strings. |
getShortMonths | public String[] getShortMonths()(Code) | | Gets short month strings. For example: "Jan", "Feb", etc.
the short month strings. |
getShortWeekdays | public String[] getShortWeekdays()(Code) | | Gets short weekday strings. For example: "Sun", "Mon", etc.
the short weekday strings. Use Calendar.SUNDAY ,Calendar.MONDAY , etc. to index the result array. |
getWeekdays | public String[] getWeekdays()(Code) | | Gets weekday strings. For example: "Sunday", "Monday", etc.
the weekday strings. Use Calendar.SUNDAY ,Calendar.MONDAY , etc. to index the result array. |
getZoneIndex | final int getZoneIndex(String ID)(Code) | | Package private: used by SimpleDateFormat
Gets the index for the given time zone ID to obtain the time zone
strings for formatting. The time zone ID is just for programmatic
lookup. NOT LOCALIZED!!!
Parameters: ID - the given time zone ID. the index of the given time zone ID. Returns -1 ifthe given time zone ID can't be located in the DateFormatSymbols object. See Also: java.util.SimpleTimeZone |
getZoneStrings | public String[][] getZoneStrings()(Code) | | Gets time zone strings. Use of this method is discouraged; use
java.util.TimeZone.getDisplayName TimeZone.getDisplayName()
instead.
The value returned is a
two-dimensional array of strings of size n by m,
where m is at least 5. Each of the n rows is an
entry containing the localized names for a single TimeZone .
Each such row contains (with i ranging from
0..n-1):
zoneStrings[i][0] - time zone ID
zoneStrings[i][1] - long name of zone in standard
time
zoneStrings[i][2] - short name of zone in
standard time
zoneStrings[i][3] - long name of zone in daylight
saving time
zoneStrings[i][4] - short name of zone in daylight
saving time
The zone ID is not localized; it's one of the valid IDs of
the
java.util.TimeZone TimeZone class that are not
custom IDs.
All other entries are localized names. If a zone does not implement
daylight saving time, the daylight saving time names should not be used.
If
DateFormatSymbols.setZoneStrings(String[][]) setZoneStrings has been called
on this DateFormatSymbols instance, then the strings
provided by that call are returned. Otherwise, the returned array
contains names provided by the Java runtime and by installed
java.util.spi.TimeZoneNameProvider TimeZoneNameProvider
implementations.
the time zone strings. See Also: DateFormatSymbols.setZoneStrings(String[][]) |
getZoneStringsWrapper | final String[][] getZoneStringsWrapper()(Code) | | Wrapper method to the getZoneStrings(), which is called from inside
the java.text package and not to mutate the returned arrays, so that
it does not need to create a defensive copy.
|
hashCode | public int hashCode()(Code) | | Override hashCode.
Generates a hash code for the DateFormatSymbols object.
|
setAmPmStrings | public void setAmPmStrings(String[] newAmpms)(Code) | | Sets ampm strings. For example: "AM" and "PM".
Parameters: newAmpms - the new ampm strings. |
setEras | public void setEras(String[] newEras)(Code) | | Sets era strings. For example: "AD" and "BC".
Parameters: newEras - the new era strings. |
setLocalPatternChars | public void setLocalPatternChars(String newLocalPatternChars)(Code) | | Sets localized date-time pattern characters. For example: 'u', 't', etc.
Parameters: newLocalPatternChars - the new localized date-timepattern characters. |
setMonths | public void setMonths(String[] newMonths)(Code) | | Sets month strings. For example: "January", "February", etc.
Parameters: newMonths - the new month strings. |
setShortMonths | public void setShortMonths(String[] newShortMonths)(Code) | | Sets short month strings. For example: "Jan", "Feb", etc.
Parameters: newShortMonths - the new short month strings. |
setShortWeekdays | public void setShortWeekdays(String[] newShortWeekdays)(Code) | | Sets short weekday strings. For example: "Sun", "Mon", etc.
Parameters: newShortWeekdays - the new short weekday strings. The array shouldbe indexed by Calendar.SUNDAY ,Calendar.MONDAY , etc. |
setWeekdays | public void setWeekdays(String[] newWeekdays)(Code) | | Sets weekday strings. For example: "Sunday", "Monday", etc.
Parameters: newWeekdays - the new weekday strings. The array shouldbe indexed by Calendar.SUNDAY ,Calendar.MONDAY , etc. |
setZoneStrings | public void setZoneStrings(String[][] newZoneStrings)(Code) | | Sets time zone strings. The argument must be a
two-dimensional array of strings of size n by m,
where m is at least 5. Each of the n rows is an
entry containing the localized names for a single TimeZone .
Each such row contains (with i ranging from
0..n-1):
zoneStrings[i][0] - time zone ID
zoneStrings[i][1] - long name of zone in standard
time
zoneStrings[i][2] - short name of zone in
standard time
zoneStrings[i][3] - long name of zone in daylight
saving time
zoneStrings[i][4] - short name of zone in daylight
saving time
The zone ID is not localized; it's one of the valid IDs of
the
java.util.TimeZone TimeZone class that are not
custom IDs.
All other entries are localized names.
Parameters: newZoneStrings - the new time zone strings. exception: IllegalArgumentException - if the length of any row innewZoneStrings is less than 5 exception: NullPointerException - if newZoneStrings is null See Also: DateFormatSymbols.getZoneStrings() |
|
|