java.lang.Objectjava.text.DateFormatSymbols
All Implemented Interfaces:
Cloneable, Serializable
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.
Chen-Lieh
- HuangField Summary | ||
---|---|---|
String[] | eras | Era strings. For example: "AD" and "BC". An array of 2 strings,
indexed by Calendar.BC and Calendar.AD .
|
String[] | months | Month strings. For example: "January", "February", etc. An array
of 13 strings (some calendars have 13 months), indexed by
Calendar.JANUARY , Calendar.FEBRUARY , etc.
|
String[] | shortMonths | 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.
|
String[] | weekdays | 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.
|
String[] | shortWeekdays | 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.
|
String[] | ampms | AM and PM strings. For example: "AM" and "PM". An array of
2 strings, indexed by Calendar.AM and
Calendar.PM .
|
String[][] | zoneStrings | 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):
|
transient boolean | isZoneStringsSet | Indicates that zoneStrings is set externally with setZoneStrings() method. |
static final String | patternChars | Unlocalized date-time pattern characters. For example: 'y', 'd', etc. All locales use the same these unlocalized pattern characters. |
static final int | PATTERN_ERA | |
static final int | PATTERN_YEAR | |
static final int | PATTERN_MONTH | |
static final int | PATTERN_DAY_OF_MONTH | |
static final int | PATTERN_HOUR_OF_DAY1 | |
static final int | PATTERN_HOUR_OF_DAY0 | |
static final int | PATTERN_MINUTE | |
static final int | PATTERN_SECOND | |
static final int | PATTERN_MILLISECOND | |
static final int | PATTERN_DAY_OF_WEEK | |
static final int | PATTERN_DAY_OF_YEAR | |
static final int | PATTERN_DAY_OF_WEEK_IN_MONTH | |
static final int | PATTERN_WEEK_OF_YEAR | |
static final int | PATTERN_WEEK_OF_MONTH | |
static final int | PATTERN_AM_PM | |
static final int | PATTERN_HOUR1 | |
static final int | PATTERN_HOUR0 | |
static final int | PATTERN_ZONE_NAME | |
static final int | PATTERN_ZONE_VALUE | |
static final int | PATTERN_WEEK_YEAR | |
static final int | PATTERN_ISO_DAY_OF_WEEK | |
static final int | PATTERN_ISO_ZONE | |
String | localPatternChars | 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 | The locale which is used for initializing this DateFormatSymbols object.
|
static final long | serialVersionUID | |
static final int | millisPerHour | Useful constant for defining time zone offsets. |
Constructor: |
---|
|
|
Method from java.text.DateFormatSymbols Summary: |
---|
clone, equals, getAmPmStrings, getAvailableLocales, getEras, getInstance, getInstance, getInstanceRef, getLocalPatternChars, getMonths, getShortMonths, getShortWeekdays, getWeekdays, getZoneIndex, getZoneStrings, getZoneStringsWrapper, hashCode, setAmPmStrings, setEras, setLocalPatternChars, setMonths, setShortMonths, setShortWeekdays, setWeekdays, setZoneStrings |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from java.text.DateFormatSymbols Detail: |
---|
|
|
|
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
DateFormatSymbolsProvider
implementations. It must contain at least a Locale
instance equal to Locale.US . |
|
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
DateFormatSymbolsProvider
implementations. |
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
DateFormatSymbolsProvider
implementations. |
|
|
|
|
|
|
|
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
If setZoneStrings has been called
on this |
|
|
|
|
|
|
|
|
|
TimeZone .
Each such row contains (with i ranging from
0..n-1):
|