# DateFormatSymbols

public class **DateFormatSymbols** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html) [Cloneable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Cloneable.html) `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.
`SimpleDateFormat` uses
`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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormat.html`.


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

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormat.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/SimpleDateFormat.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/SimpleTimeZone.html`

### Public Constructor Summary

|---|---|
|   | [DateFormatSymbols](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#DateFormatSymbols())() Construct a DateFormatSymbols object by loading format data from resources for the default `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#FORMAT` locale. |
|   | [DateFormatSymbols](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#DateFormatSymbols(java.util.Locale))([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale) Construct a DateFormatSymbols object by loading format data from resources for the given locale. |

### Public Method Summary

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#clone())() Overrides Cloneable |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Override equals |
| [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getAmPmStrings](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getAmPmStrings())() Gets ampm strings. |
| static [Locale\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) | [getAvailableLocales](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getAvailableLocales())() Returns an array of all locales for which the `getInstance` methods of this class can return localized instances. |
| [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getEras](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getEras())() Gets era strings. |
| final static [DateFormatSymbols](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html) | [getInstance](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getInstance())() Gets the `DateFormatSymbols` instance for the default locale. |
| final static [DateFormatSymbols](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html) | [getInstance](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getInstance(java.util.Locale))([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale) Gets the `DateFormatSymbols` instance for the specified locale. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getLocalPatternChars](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getLocalPatternChars())() Gets localized date-time pattern characters. |
| [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getMonths](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getMonths())() Gets month strings. |
| [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getShortMonths](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getShortMonths())() Gets short month strings. |
| [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getShortWeekdays](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getShortWeekdays())() Gets short weekday strings. |
| [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getWeekdays](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getWeekdays())() Gets weekday strings. |
| [String\[\]\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getZoneStrings](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getZoneStrings())() Gets time zone strings. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#hashCode())() Override hashCode. |
| void | [setAmPmStrings](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setAmPmStrings(java.lang.String[]))([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newAmpms) Sets ampm strings. |
| void | [setEras](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setEras(java.lang.String[]))([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newEras) Sets era strings. |
| void | [setLocalPatternChars](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setLocalPatternChars(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newLocalPatternChars) Sets localized date-time pattern characters. |
| void | [setMonths](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setMonths(java.lang.String[]))([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newMonths) Sets month strings. |
| void | [setShortMonths](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setShortMonths(java.lang.String[]))([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newShortMonths) Sets short month strings. |
| void | [setShortWeekdays](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setShortWeekdays(java.lang.String[]))([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newShortWeekdays) Sets short weekday strings. |
| void | [setWeekdays](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setWeekdays(java.lang.String[]))([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newWeekdays) Sets weekday strings. |
| void | [setZoneStrings](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setZoneStrings(java.lang.String[][]))([String\[\]\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newZoneStrings) Sets time zone strings. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**DateFormatSymbols**
()

Construct a DateFormatSymbols object by loading format data from
resources for the default `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#FORMAT`
locale. It is recommended that the `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getInstance(java.util.Locale)` method is used
instead.

This is equivalent to calling
`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#DateFormatSymbols(java.util.Locale)`.

##### Throws

| [MissingResourceException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/MissingResourceException.html) | if the resources for the default locale cannot be found or cannot be loaded. |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getInstance()`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html#getDefault(java.util.Locale.Category)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#FORMAT`

#### public
**DateFormatSymbols**
([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale)

Construct a DateFormatSymbols object by loading format data from
resources for the given locale. It is recommended that the
`https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getInstance(java.util.Locale)` method is used instead.

##### Parameters

| locale | the desired locale |
|---|---|

##### Throws

| [MissingResourceException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/MissingResourceException.html) | if the resources for the specified locale cannot be found or cannot be loaded. |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getInstance(java.util.Locale)`

## Public Methods

#### public [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**clone**
()

Overrides Cloneable

##### Returns

- a copy of this object.

#### public boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj)

Override equals

##### Parameters

| obj | the object to compare this instance with. |
|---|---|

##### Returns

- `true` if the specified object is equal to this `Object`; `false` otherwise.

#### public [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getAmPmStrings**
()

Gets ampm strings. For example: "AM" and "PM".

##### Returns

- the ampm strings.

#### public static [Locale\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html)
**getAvailableLocales**
()

Returns an array of all locales for which the
`getInstance` methods of this class can return
localized instances.

##### Returns

- An array of locales for which localized `DateFormatSymbols` instances are available.

#### public [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getEras**
()

Gets era strings. For example: "AD" and "BC".

##### Returns

- the era strings.

#### public static final [DateFormatSymbols](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html)
**getInstance**
()

Gets the `DateFormatSymbols` instance for the default
locale.

This is equivalent to calling `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getInstance(java.util.Locale)`.

##### Returns

- a `DateFormatSymbols` instance.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html#getDefault(java.util.Locale.Category)`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html#FORMAT`

#### public static final [DateFormatSymbols](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html)
**getInstance**
([Locale](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.html) locale)

Gets the `DateFormatSymbols` instance for the specified
locale.

##### Parameters

| locale | the given locale. |
|---|---|

##### Returns

- a `DateFormatSymbols` instance.

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `locale` is null |
|---|---|

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getLocalPatternChars**
()

Gets localized date-time pattern characters. For example: 'u', 't', etc.

##### Returns

- the localized date-time pattern characters.

#### public [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getMonths**
()

Gets month strings. For example: "January", "February", etc.

If the language requires different forms for formatting and
stand-alone usages, this method returns month names in the
formatting form. For example, the preferred month name for
January in the Czech language is *ledna* in the
formatting form, while it is *leden* in the stand-alone
form. This method returns `"ledna"` in this case. Refer
to the [Calendar Elements in the Unicode Locale Data Markup Language
(LDML) specification](http://unicode.org/reports/tr35/#Calendar_Elements) for more details.

##### Returns

- the month strings.

#### public [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getShortMonths**
()

Gets short month strings. For example: "Jan", "Feb", etc.

If the language requires different forms for formatting and
stand-alone usages, This method returns short month names in
the formatting form. For example, the preferred abbreviation
for January in the Catalan language is *de gen.* in the
formatting form, while it is *gen.* in the stand-alone
form. This method returns `"de gen."` in this case. Refer
to the [Calendar Elements in the Unicode Locale Data Markup Language
(LDML) specification](http://unicode.org/reports/tr35/#Calendar_Elements) for more details.

##### Returns

- the short month strings.

#### public [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getShortWeekdays**
()

Gets short weekday strings. For example: "Sun", "Mon", etc.

##### Returns

- the short weekday strings. Use `Calendar.SUNDAY`, `Calendar.MONDAY`, etc. to index the result array.

#### public [String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getWeekdays**
()

Gets weekday strings. For example: "Sunday", "Monday", etc.

##### Returns

- the weekday strings. Use `Calendar.SUNDAY`, `Calendar.MONDAY`, etc. to index the result array.

#### public [String\[\]\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**getZoneStrings**
()

Gets time zone strings. Use of this method is discouraged; use
`https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html#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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html` class that are not [custom IDs](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html#CustomID). 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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setZoneStrings(java.lang.String[][])` 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 runtime.

##### Returns

- the time zone strings.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#setZoneStrings(java.lang.String[][])`

#### public int
**hashCode**
()

Override hashCode.
Generates a hash code for the DateFormatSymbols object.

##### Returns

- this object's hash code.

#### public void
**setAmPmStrings**
([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newAmpms)

Sets ampm strings. For example: "AM" and "PM".

##### Parameters

| newAmpms | the new ampm strings. |
|---|---|

#### public void
**setEras**
([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newEras)

Sets era strings. For example: "AD" and "BC".

##### Parameters

| newEras | the new era strings. |
|---|---|

#### public void
**setLocalPatternChars**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newLocalPatternChars)

Sets localized date-time pattern characters. For example: 'u', 't', etc.

##### Parameters

| newLocalPatternChars | the new localized date-time pattern characters. |
|---|---|

#### public void
**setMonths**
([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newMonths)

Sets month strings. For example: "January", "February", etc.

##### Parameters

| newMonths | the new month strings. |
|---|---|

#### public void
**setShortMonths**
([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newShortMonths)

Sets short month strings. For example: "Jan", "Feb", etc.

##### Parameters

| newShortMonths | the new short month strings. |
|---|---|

#### public void
**setShortWeekdays**
([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newShortWeekdays)

Sets short weekday strings. For example: "Sun", "Mon", etc.

##### Parameters

| newShortWeekdays | the new short weekday strings. The array should be indexed by `Calendar.SUNDAY`, `Calendar.MONDAY`, etc. |
|---|---|

#### public void
**setWeekdays**
([String\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newWeekdays)

Sets weekday strings. For example: "Sunday", "Monday", etc.

##### Parameters

| newWeekdays | the new weekday strings. The array should be indexed by `Calendar.SUNDAY`, `Calendar.MONDAY`, etc. |
|---|---|

#### public void
**setZoneStrings**
([String\[\]\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) newZoneStrings)

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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html` class that are not [custom IDs](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/TimeZone.html#CustomID). All other entries are localized names.

<br />

##### Parameters

| newZoneStrings | the new time zone strings. |
|---|---|

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the length of any row in `newZoneStrings` is less than 5 |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `newZoneStrings` is null |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/text/DateFormatSymbols.html#getZoneStrings()`