java.lang.Object | |
↳ | java.text.DateFormatSymbols |
Encapsulates localized 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
.
Direct use of DateFormatSymbols
is likely to be less efficient
because the implementation cannot make assumptions about user-supplied/user-modifiable data
to the same extent that it can with its own built-in data.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new
DateFormatSymbols instance containing the
symbols for the user's default locale. | |||||||||||
Constructs a new
DateFormatSymbols instance containing the
symbols for the specified locale. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates and returns a copy of this
Object . | |||||||||||
Compares this object with the specified object and indicates if they are
equal.
| |||||||||||
Returns the array of strings which represent AM and PM.
| |||||||||||
Returns an array of locales for which custom
DateFormatSymbols instances
are available. | |||||||||||
Returns the array of strings which represent BC and AD.
| |||||||||||
Returns a new
DateFormatSymbols instance for the user's default locale. | |||||||||||
Returns a new
DateFormatSymbols for the given locale. | |||||||||||
Returns the pattern characters used by
SimpleDateFormat to
specify date and time fields. | |||||||||||
Returns the array of strings containing the full names of the months.
| |||||||||||
Returns the array of strings containing the abbreviated names of the
months.
| |||||||||||
Returns the array of strings containing the abbreviated names of the days
of the week.
| |||||||||||
Returns the array of strings containing the full names of the days of the
week.
| |||||||||||
Returns the two-dimensional array of strings containing localized names for time zones.
| |||||||||||
Returns an integer hash code for this object.
| |||||||||||
Sets the array of strings which represent AM and PM.
| |||||||||||
Sets the array of Strings which represent BC and AD.
| |||||||||||
Sets the pattern characters used by
SimpleDateFormat to specify
date and time fields. | |||||||||||
Sets the array of strings containing the full names of the months.
| |||||||||||
Sets the array of strings containing the abbreviated names of the months.
| |||||||||||
Sets the array of strings containing the abbreviated names of the days of
the week.
| |||||||||||
Sets the array of strings containing the full names of the days of the
week.
| |||||||||||
Sets the two-dimensional array of strings containing localized names for time zones.
| |||||||||||
Returns a string containing a concise, human-readable description of this
object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Constructs a new DateFormatSymbols
instance containing the
symbols for the user's default locale.
See "Be wary of the default locale".
Constructs a new DateFormatSymbols
instance containing the
symbols for the specified locale.
locale | the locale. |
---|
Creates and returns a copy of this Object
. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.
Compares this object with the specified object and indicates if they are equal.
object | the object to compare with this object. |
---|
true
if object
is an instance of
DateFormatSymbols
and has the same symbols as this
object, false
otherwise.Returns the array of strings which represent AM and PM. Use the
Calendar
constants Calendar.AM
and
Calendar.PM
as indices for the array.
Returns an array of locales for which custom DateFormatSymbols
instances
are available.
Note that Android does not support user-supplied locale service providers.
Returns the array of strings which represent BC and AD. Use the
Calendar
constants GregorianCalendar.BC
and
GregorianCalendar.AD
as indices for the array.
Returns a new DateFormatSymbols
instance for the user's default locale.
See "Be wary of the default locale".
DateFormatSymbols
Returns a new DateFormatSymbols
for the given locale.
locale | the locale |
---|
DateFormatSymbols
NullPointerException | if locale == null |
---|
Returns the pattern characters used by SimpleDateFormat
to
specify date and time fields.
Returns the array of strings containing the full names of the months. Use
the Calendar
constants Calendar.JANUARY
etc. as
indices for the array.
Returns the array of strings containing the abbreviated names of the
months. Use the Calendar
constants
Calendar.JANUARY
etc. as indices for the array.
Returns the array of strings containing the abbreviated names of the days
of the week. Use the Calendar
constants
Calendar.SUNDAY
etc. as indices for the array.
Returns the array of strings containing the full names of the days of the
week. Use the Calendar
constants
Calendar.SUNDAY
etc. as indices for the array.
Returns the two-dimensional array of strings containing localized names for time zones. Each row is an array of five strings:
Returns an integer hash code for this object. By contract, any two
objects for which equals(Object)
returns true
must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode
method
if you intend implementing your own hashCode
method.
Sets the array of strings which represent AM and PM. Use the
Calendar
constants Calendar.AM
and
Calendar.PM
as indices for the array.
data | the array of strings for AM and PM. |
---|
Sets the array of Strings which represent BC and AD. Use the
Calendar
constants GregorianCalendar.BC
and
GregorianCalendar.AD
as indices for the array.
data | the array of strings for BC and AD. |
---|
Sets the pattern characters used by SimpleDateFormat
to specify
date and time fields.
data | the string containing the pattern characters. |
---|
NullPointerException | if data is null
|
---|
Sets the array of strings containing the full names of the months. Use
the Calendar
constants Calendar.JANUARY
etc. as
indices for the array.
data | the array of strings. |
---|
Sets the array of strings containing the abbreviated names of the months.
Use the Calendar
constants Calendar.JANUARY
etc. as indices for the array.
data | the array of strings. |
---|
Sets the array of strings containing the abbreviated names of the days of
the week. Use the Calendar
constants
Calendar.SUNDAY
etc. as indices for the array.
data | the array of strings. |
---|
Sets the array of strings containing the full names of the days of the
week. Use the Calendar
constants
Calendar.SUNDAY
etc. as indices for the array.
data | the array of strings. |
---|
Sets the two-dimensional array of strings containing localized names for time zones.
See getZoneStrings()
for details.
IllegalArgumentException | if any row has fewer than 5 elements. |
---|---|
NullPointerException | if zoneStrings == null .
|
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.