public class

DateFormatSymbols

extends Object
implements Serializable Cloneable
java.lang.Object
   ↳ java.text.DateFormatSymbols

Class Overview

Encapsulates 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 can be cloned. 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.

Summary

Public Constructors
DateFormatSymbols()
Constructs a new DateFormatSymbols instance containing the symbols for the default locale.
DateFormatSymbols(Locale locale)
Constructs a new DateFormatSymbols instance containing the symbols for the specified locale.
Public Methods
Object clone()
Creates and returns a copy of this Object.
boolean equals(Object object)
Compares this object with the specified object and indicates if they are equal.
String[] getAmPmStrings()
Returns the array of strings which represent AM and PM.
String[] getEras()
Returns the array of strings which represent BC and AD.
String getLocalPatternChars()
Returns the pattern characters used by SimpleDateFormat to specify date and time fields.
String[] getMonths()
Returns the array of strings containing the full names of the months.
String[] getShortMonths()
Returns the array of strings containing the abbreviated names of the months.
String[] getShortWeekdays()
Returns the array of strings containing the abbreviated names of the days of the week.
String[] getWeekdays()
Returns the array of strings containing the full names of the days of the week.
String[][] getZoneStrings()
Returns the two-dimensional array of strings containing the names of the time zones.
int hashCode()
Returns an integer hash code for this object.
void setAmPmStrings(String[] data)
Sets the array of strings which represent AM and PM.
void setEras(String[] data)
Sets the array of Strings which represent BC and AD.
void setLocalPatternChars(String data)
Sets the pattern characters used by SimpleDateFormat to specify date and time fields.
void setMonths(String[] data)
Sets the array of strings containing the full names of the months.
void setShortMonths(String[] data)
Sets the array of strings containing the abbreviated names of the months.
void setShortWeekdays(String[] data)
Sets the array of strings containing the abbreviated names of the days of the week.
void setWeekdays(String[] data)
Sets the array of strings containing the full names of the days of the week.
void setZoneStrings(String[][] data)
Sets the two-dimensional array of strings containing the names of the time zones.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DateFormatSymbols ()

Constructs a new DateFormatSymbols instance containing the symbols for the default locale.

public DateFormatSymbols (Locale locale)

Constructs a new DateFormatSymbols instance containing the symbols for the specified locale.

Parameters
locale the locale.

Public Methods

public Object clone ()

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.

Returns
  • a copy of this object.

public boolean equals (Object object)

Compares this object with the specified object and indicates if they are equal.

Parameters
object the object to compare with this object.
Returns
  • true if object is an instance of DateFormatSymbols and has the same symbols as this object, false otherwise.
See Also

public String[] getAmPmStrings ()

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 strings.

public String[] getEras ()

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
  • an array of strings.

public String getLocalPatternChars ()

Returns the pattern characters used by SimpleDateFormat to specify date and time fields.

Returns
  • a string containing the pattern characters.

public String[] getMonths ()

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
  • an array of strings.

public String[] getShortMonths ()

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
  • an array of strings.

public String[] getShortWeekdays ()

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
  • an array of strings.

public String[] getWeekdays ()

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
  • an array of strings.

public String[][] getZoneStrings ()

Returns the two-dimensional array of strings containing the names of the time zones. Each element in the array is an array of five strings, the first is a TimeZone ID, the second and third are the full and abbreviated time zone names for standard time, and the fourth and fifth are the full and abbreviated names for daylight time.

Returns
  • a two-dimensional array of strings.

public int hashCode ()

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.

Returns
  • this object's hash code.

public void setAmPmStrings (String[] data)

Sets the array of strings which represent AM and PM. Use the Calendar constants Calendar.AM and Calendar.PM as indices for the array.

Parameters
data the array of strings for AM and PM.

public void setEras (String[] data)

Sets the array of Strings which represent BC and AD. Use the Calendar constants GregorianCalendar.BC and GregorianCalendar.AD as indices for the array.

Parameters
data the array of strings for BC and AD.

public void setLocalPatternChars (String data)

Sets the pattern characters used by SimpleDateFormat to specify date and time fields.

Parameters
data the string containing the pattern characters.

public void setMonths (String[] data)

Sets the array of strings containing the full names of the months. Use the Calendar constants Calendar.JANUARY etc. as indices for the array.

Parameters
data the array of strings.

public void setShortMonths (String[] data)

Sets the array of strings containing the abbreviated names of the months. Use the Calendar constants Calendar.JANUARY etc. as indices for the array.

Parameters
data the array of strings.

public void setShortWeekdays (String[] data)

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.

Parameters
data the array of strings.

public void setWeekdays (String[] data)

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.

Parameters
data the array of strings.

public void setZoneStrings (String[][] data)

Sets the two-dimensional array of strings containing the names of the time zones. Each element in the array is an array of five strings, the first is a TimeZone ID, and second and third are the full and abbreviated time zone names for standard time, and the fourth and fifth are the full and abbreviated names for daylight time.

Parameters
data the two-dimensional array of strings.