Loading...
Searching...
No Matches
icu::DateFormatSymbols Class Referencefinal

DateFormatSymbols is a public class for encapsulating localizable date-time formatting data – including timezone data. More...

`#include <dtfmtsym.h>`

Inheritance diagram for icu::DateFormatSymbols:

## Public Types

enum | DtContextType { FORMAT , STANDALONE , DT_CONTEXT_COUNT }
| Selector for date formatting context. More...
enum | DtWidthType { ABBREVIATED , WIDE , NARROW , SHORT , DT_WIDTH_COUNT = 4 }
| Selector for date formatting width. More...
enum | EMonthPatternType { kLeapMonthPatternFormatWide , kLeapMonthPatternFormatAbbrev , kLeapMonthPatternFormatNarrow , kLeapMonthPatternStandaloneWide , kLeapMonthPatternStandaloneAbbrev , kLeapMonthPatternStandaloneNarrow , kLeapMonthPatternNumeric , kMonthPatternsCount }
| Somewhat temporary constants for leap month pattern types, adequate for supporting just leap month patterns as needed for Chinese lunar calendar. More...

enum

ECapitalizationContextUsageType {
kCapContextUsageOther = 0 , kCapContextUsageMonthFormat , kCapContextUsageMonthStandalone , kCapContextUsageMonthNarrow ,
kCapContextUsageDayFormat , kCapContextUsageDayStandalone , kCapContextUsageDayNarrow , kCapContextUsageEraWide ,
kCapContextUsageEraAbbrev , kCapContextUsageEraNarrow , kCapContextUsageZoneLong , kCapContextUsageZoneShort ,
kCapContextUsageMetazoneLong , kCapContextUsageMetazoneShort , kCapContextUsageTypeCount = 14
}

| Constants for capitalization context usage types. More...

## Public Member Functions

U_I18N_API | DateFormatSymbols (UErrorCode &status)
| Construct a DateFormatSymbols object by loading format data from resources for the default locale, in the default calendar (Gregorian).
U_I18N_API | DateFormatSymbols (const Locale &locale, UErrorCode &status)
| Construct a DateFormatSymbols object by loading format data from resources for the given locale, in the default calendar (Gregorian).
U_I18N_API | DateFormatSymbols (const char *type, UErrorCode &status)
| Construct a DateFormatSymbols object by loading format data from resources for the default locale, in the default calendar (Gregorian).
U_I18N_API | DateFormatSymbols (const Locale &locale, const char *type, UErrorCode &status)
| Construct a DateFormatSymbols object by loading format data from resources for the given locale, in the default calendar (Gregorian).
U_I18N_API | DateFormatSymbols (const DateFormatSymbols &)
| Copy constructor.
U_I18N_API DateFormatSymbols & | operator= (const DateFormatSymbols &)
| Assignment operator.
virtual U_I18N_API | ~DateFormatSymbols ()
| Destructor.
U_I18N_API bool | operator== (const DateFormatSymbols &other) const
| Return true if another object is semantically equal to this one.
U_I18N_API bool | operator!= (const DateFormatSymbols &other) const
| Return true if another object is semantically unequal to this one.
U_I18N_API const UnicodeString * | getEras (int32_t &count) const
| Gets abbreviated era strings.
U_I18N_API void | setEras (const UnicodeString *eras, int32_t count)
| Sets abbreviated era strings.
U_I18N_API const UnicodeString * | getEraNames (int32_t &count) const
| Gets era name strings.
U_I18N_API void | setEraNames (const UnicodeString *eraNames, int32_t count)
| Sets era name strings.
U_I18N_API const UnicodeString * | getNarrowEras (int32_t &count) const
| Gets narrow era strings.
U_I18N_API void | setNarrowEras (const UnicodeString *narrowEras, int32_t count)
| Sets narrow era strings.
U_I18N_API const UnicodeString * | getMonths (int32_t &count) const
| Gets month strings.
U_I18N_API void | setMonths (const UnicodeString *months, int32_t count)
| Sets month strings.
U_I18N_API const UnicodeString * | getShortMonths (int32_t &count) const
| Gets short month strings.
U_I18N_API void | setShortMonths (const UnicodeString *shortMonths, int32_t count)
| Sets short month strings.
U_I18N_API const UnicodeString * | getMonths (int32_t &count, DtContextType context, DtWidthType width) const
| Gets month strings by width and context.
U_I18N_API void | setMonths (const UnicodeString *months, int32_t count, DtContextType context, DtWidthType width)
| Sets month strings by width and context.
U_I18N_API const UnicodeString * | getWeekdays (int32_t &count) const
| Gets wide weekday strings.
U_I18N_API void | setWeekdays (const UnicodeString *weekdays, int32_t count)
| Sets wide weekday strings.
U_I18N_API const UnicodeString * | getShortWeekdays (int32_t &count) const
| Gets abbreviated weekday strings.
U_I18N_API void | setShortWeekdays (const UnicodeString *abbrevWeekdays, int32_t count)
| Sets abbreviated weekday strings.
U_I18N_API const UnicodeString * | getWeekdays (int32_t &count, DtContextType context, DtWidthType width) const
| Gets weekday strings by width and context.
U_I18N_API void | setWeekdays (const UnicodeString *weekdays, int32_t count, DtContextType context, DtWidthType width)
| Sets weekday strings by width and context.
U_I18N_API const UnicodeString * | getQuarters (int32_t &count, DtContextType context, DtWidthType width) const
| Gets quarter strings by width and context.
U_I18N_API void | setQuarters (const UnicodeString *quarters, int32_t count, DtContextType context, DtWidthType width)
| Sets quarter strings by width and context.
U_I18N_API const UnicodeString * | getAmPmStrings (int32_t &count) const
| Gets AM/PM strings.
U_I18N_API void | setAmPmStrings (const UnicodeString *ampms, int32_t count)
| Sets ampm strings.
U_I18N_API const UnicodeString * | getAmPmStrings (int32_t &count, DtContextType context, DtWidthType width) const
| Gets AM/PM strings with the specified width.
U_I18N_API void | setAmPmStrings (const UnicodeString *ampms, int32_t count, DtContextType context, DtWidthType width)
| Sets AM/PM strings with the specified width.
U_I18N_API UnicodeString & | getTimeSeparatorString (UnicodeString &result) const
| Gets the time separator string.
U_I18N_API void | setTimeSeparatorString (const UnicodeString &newTimeSeparator)
| Sets the time separator string.
U_I18N_API const UnicodeString * | getYearNames (int32_t &count, DtContextType context, DtWidthType width) const
| Gets cyclic year name strings if the calendar has them, by width and context.
U_I18N_API void | setYearNames (const UnicodeString *yearNames, int32_t count, DtContextType context, DtWidthType width)
| Sets cyclic year name strings by width and context.
U_I18N_API const UnicodeString * | getZodiacNames (int32_t &count, DtContextType context, DtWidthType width) const
| Gets calendar zodiac name strings if the calendar has them, by width and context.
U_I18N_API void | setZodiacNames (const UnicodeString *zodiacNames, int32_t count, DtContextType context, DtWidthType width)
| Sets calendar zodiac name strings by width and context.
U_I18N_API const UnicodeString * | getLeapMonthPatterns (int32_t &count) const
| Somewhat temporary function for getting complete set of leap month patterns for all contexts & widths, indexed by EMonthPatternType values.
U_I18N_API const UnicodeString ** | getZoneStrings (int32_t &rowCount, int32_t &columnCount) const
| Gets timezone strings.
U_I18N_API void | setZoneStrings (const UnicodeString *const *strings, int32_t rowCount, int32_t columnCount)
| Sets timezone strings.
U_I18N_API UnicodeString & | getLocalPatternChars (UnicodeString &result) const
| Gets localized date-time pattern characters.
U_I18N_API void | setLocalPatternChars (const UnicodeString &newLocalPatternChars)
| Sets localized date-time pattern characters.
U_I18N_API Locale | getLocale (ULocDataLocaleType type, UErrorCode &status) const
| Returns the locale for this object.
virtual U_I18N_API UClassID | getDynamicClassID () const override
| ICU "poor man's RTTI", returns a UClassID for the actual class.
Public Member Functions inherited from icu::UObject
virtual | ~UObject ()
| Destructor.

## Static Public Member Functions

static U_I18N_API const char16_t * | getPatternUChars ()
| Get the non-localized date-time pattern characters.
static U_I18N_API UClassID | getStaticClassID ()
| ICU "poor man's RTTI", returns a UClassID for this class.
static U_I18N_API DateFormatSymbols * | createForLocale (const Locale &locale, UErrorCode &status)
| Gets a DateFormatSymbols by locale.

## Static Public Attributes

static U_I18N_API const char16_t | DEFAULT_TIME_SEPARATOR = 0x003a
| This default time separator is used for formatting when the locale doesn't specify any time separator, and always recognized when parsing.
static U_I18N_API const char16_t | ALTERNATE_TIME_SEPARATOR = 0x002e
| This alternate time separator is always recognized when parsing.

## Friends

class | SimpleDateFormat
class | DateFormatSymbolsSingleSetter

## Detailed Description

DateFormatSymbols is a public class for encapsulating localizable date-time formatting data – including timezone data.

DateFormatSymbols is used by DateFormat and SimpleDateFormat.

Rather than first creating a DateFormatSymbols to get a date-time formatter by using a SimpleDateFormat constructor, clients are encouraged to create a date-time formatter using the getTimeInstance(), getDateInstance(), or getDateTimeInstance() method in DateFormat. Each of these methods can return a date/time formatter initialized with a default format pattern along with the date-time formatting data for a given or default locale. After a formatter is created, clients may modify the format pattern using the setPattern function as so desired. For more information on using these formatter factory functions, see DateFormat.

If clients decide to create a date-time formatter with a particular format pattern and locale, they can do so with new SimpleDateFormat(aPattern, new DateFormatSymbols(aLocale)). This will load the appropriate date-time formatting data from the locale.

DateFormatSymbols objects are clonable. When clients obtain a DateFormatSymbols object, they can feel free to modify the date-time formatting data as necessary. For instance, clients can replace the localized date-time format pattern characters with the ones that they feel easy to remember. Or they can change the representative cities originally picked by default to using their favorite ones.

DateFormatSymbols are not expected to be subclassed. Data for a calendar is loaded out of resource bundles. The 'type' parameter indicates the type of calendar, for example, "gregorian" or "japanese". If the type is not gregorian (or nullptr, or an empty string) then the type is appended to the resource name, for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japanese' did not exist (even in root), then this class will fall back to just 'Eras', that is, Gregorian data. Therefore, the calendar implementor MUST ensure that the root locale at least contains any resources that are to be particularized for the calendar type.

Definition at line 84 of file dtfmtsym.h.

## Member Enumeration Documentation

## DtContextType

enum icu::DateFormatSymbols::DtContextType

Selector for date formatting context.

Stable
  ICU 3.6

Enumerator

DT_CONTEXT_COUNT

One more than the highest normal DtContextType value.

Deprecated
  ICU 58 The numeric value may change over time, see ICU ticket #12420.

Definition at line 274 of file dtfmtsym.h.

## DtWidthType

enum icu::DateFormatSymbols::DtWidthType

Selector for date formatting width.

Stable
  ICU 3.6

Enumerator

SHORT

Short width is currently only supported for weekday names.

Stable
  ICU 51

DT_WIDTH_COUNT

One more than the highest normal DtWidthType value.

Deprecated
  ICU 58 The numeric value may change over time, see ICU ticket #12420.

Definition at line 290 of file dtfmtsym.h.

## ECapitalizationContextUsageType

enum icu::DateFormatSymbols::ECapitalizationContextUsageType

Constants for capitalization context usage types.

Internal
  Do not use. This API is for internal use only.

Definition at line 651 of file dtfmtsym.h.

## EMonthPatternType

enum icu::DateFormatSymbols::EMonthPatternType

Somewhat temporary constants for leap month pattern types, adequate for supporting just leap month patterns as needed for Chinese lunar calendar.

Eventually we will add full support for different month pattern types (needed for other calendars such as Hindu) at which point this approach will be replaced by a more complete approach.

Internal
  Do not use. This API is for internal use only.

Definition at line 557 of file dtfmtsym.h.

## Constructor & Destructor Documentation

## DateFormatSymbols() [1/5]

U_I18N_API icu::DateFormatSymbols::DateFormatSymbols | ( | UErrorCode & | status | ) |

Construct a DateFormatSymbols object by loading format data from resources for the default locale, in the default calendar (Gregorian).

NOTE: This constructor will never fail; if it cannot get resource data for the default locale, it will return a last-resort object based on hard-coded strings.

Parameters

  status | Status code. Failure results if the resources for the default cannot be found or cannot be loaded

Stable
  ICU 2.0

References U_I18N_API.

Referenced by createForLocale(), DateFormatSymbols(), getStaticClassID(), operator!=(), operator=(), and operator==().

## DateFormatSymbols() [2/5]

U_I18N_API icu::DateFormatSymbols::DateFormatSymbols | ( | const Locale & | locale,
|  | UErrorCode & | status )

Construct a DateFormatSymbols object by loading format data from resources for the given locale, in the default calendar (Gregorian).

Parameters

  locale | Locale to load format data from.
  status | Status code. Failure results if the resources for the locale cannot be found or cannot be loaded

Stable
  ICU 2.0

References U_I18N_API.

## DateFormatSymbols() [3/5]

U_I18N_API icu::DateFormatSymbols::DateFormatSymbols | ( | const char * | type,
|  | UErrorCode & | status )

Construct a DateFormatSymbols object by loading format data from resources for the default locale, in the default calendar (Gregorian).

NOTE: This constructor will never fail; if it cannot get resource data for the default locale, it will return a last-resort object based on hard-coded strings.

Parameters

  type | Type of calendar (as returned by Calendar::getType). Will be used to access the correct set of strings. (nullptr or empty string defaults to "gregorian".)
  status | Status code. Failure results if the resources for the default cannot be found or cannot be loaded

Internal
  Do not use. This API is for internal use only.

References U_I18N_API.

## DateFormatSymbols() [4/5]

U_I18N_API icu::DateFormatSymbols::DateFormatSymbols | ( | const Locale & | locale,
|  | const char * | type,
|  | UErrorCode & | status )

Construct a DateFormatSymbols object by loading format data from resources for the given locale, in the default calendar (Gregorian).

Parameters

  locale | Locale to load format data from.
  type | Type of calendar (as returned by Calendar::getType). Will be used to access the correct set of strings. (nullptr or empty string defaults to "gregorian".)
  status | Status code. Failure results if the resources for the locale cannot be found or cannot be loaded

Internal
  Do not use. This API is for internal use only.

References U_I18N_API.

## DateFormatSymbols() [5/5]

U_I18N_API icu::DateFormatSymbols::DateFormatSymbols | ( | const DateFormatSymbols & |  | ) |

Copy constructor.

Stable
  ICU 2.0

References DateFormatSymbols(), and U_I18N_API.

## ~DateFormatSymbols()

virtual U_I18N_API icu::DateFormatSymbols::~DateFormatSymbols | ( |  | ) |

virtual

Destructor.

This is nonvirtual because this class is not designed to be subclassed.

Stable
  ICU 2.0

References U_I18N_API.

## Member Function Documentation

## createForLocale()

U_I18N_API DateFormatSymbols * icu::DateFormatSymbols::createForLocale | ( | const Locale & | locale,
|  | UErrorCode & | status )

static

Gets a DateFormatSymbols by locale.

Unlike the constructors which always use gregorian calendar, this method uses the calendar in the locale. If the locale contains no explicit calendar, this method uses the default calendar for that locale.

Parameters

  locale | the locale.
  status | error returned here.

Returns
  the new DateFormatSymbols which the caller owns.

Internal
  Do not use. This API is for internal use only. For ICU use only.

References DateFormatSymbols(), and U_I18N_API.

## getAmPmStrings() [1/2]

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getAmPmStrings | ( | int32_t & | count | ) | const

Gets AM/PM strings.

For example: "AM" and "PM".

Parameters

  count | Filled in with length of the array.

Returns
  The AM/PM strings. (DateFormatSymbols retains ownership.)

Stable
  ICU 2.0

References U_I18N_API.

## getAmPmStrings() [2/2]

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getAmPmStrings | ( | int32_t & | count,
|  | DtContextType | context,
|  | DtWidthType | width ) const

Gets AM/PM strings with the specified width.

For example: "A" and "P".

Parameters

  count | Filled in with length of the array.
  context | The usage context. Currently ignored; FORMAT names always returned.
  width | The width of returned strings, either WIDE, ABBREVIATED, or NARROW.

Returns
  The AM/PM strings. (DateFormatSymbols retains ownership.)

Draft
  This API may be changed in the future versions and was introduced in ICU 78

References U_I18N_API.

## getDynamicClassID()

virtual U_I18N_API UClassID icu::DateFormatSymbols::getDynamicClassID | ( |  | ) | const

override virtual

ICU "poor man's RTTI", returns a UClassID for the actual class.

Stable
  ICU 2.2

Reimplemented from icu::UObject.

References U_I18N_API.

## getEraNames()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getEraNames | ( | int32_t & | count | ) | const

Gets era name strings.

For example: "Anno Domini" and "Before Christ".

Parameters

  count | Filled in with length of the array.

Returns
  the era name strings.

Stable
  ICU 3.4

References U_I18N_API.

## getEras()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getEras | ( | int32_t & | count | ) | const

Gets abbreviated era strings.

For example: "AD" and "BC".

Parameters

  count | Filled in with length of the array.

Returns
  the era strings.

Stable
  ICU 2.0

References U_I18N_API.

## getLeapMonthPatterns()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getLeapMonthPatterns | ( | int32_t & | count | ) | const

Somewhat temporary function for getting complete set of leap month patterns for all contexts & widths, indexed by EMonthPatternType values.

Returns nullptr if calendar does not have leap month patterns. Note, there is currently no setter for this. Eventually we will add full support for different month pattern types (needed for other calendars such as Hindu) at which point this approach will be replaced by a more complete approach.

Parameters

  count | Filled in with length of the array (may be 0).

Returns
  The leap month patterns (DateFormatSymbols retains ownership). May be nullptr if there are no leap month patterns for this calendar.

Internal
  Do not use. This API is for internal use only.

References U_I18N_API.

## getLocale()

U_I18N_API Locale icu::DateFormatSymbols::getLocale | ( | ULocDataLocaleType | type,
|  | UErrorCode & | status ) const

Returns the locale for this object.

Two flavors are available: valid and actual locale.

Stable
  ICU 2.8

References U_I18N_API.

## getLocalPatternChars()

U_I18N_API UnicodeString & icu::DateFormatSymbols::getLocalPatternChars | ( | UnicodeString & | result | ) | const

Gets localized date-time pattern characters.

For example: 'u', 't', etc.

Note: ICU no longer provides localized date-time pattern characters for a locale starting ICU 3.8. This method returns the non-localized date-time pattern characters unless user defined localized data is set by setLocalPatternChars.

Parameters

  result | Output param which will receive the localized date-time pattern characters.

Returns
  A reference to 'result'.

Stable
  ICU 2.0

References U_I18N_API.

## getMonths() [1/2]

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getMonths | ( | int32_t & | count | ) | const

Gets month strings.

For example: "January", "February", etc.

Parameters

  count | Filled in with length of the array.

Returns
  the month strings. (DateFormatSymbols retains ownership.)

Stable
  ICU 2.0

References U_I18N_API.

## getMonths() [2/2]

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getMonths | ( | int32_t & | count,
|  | DtContextType | context,
|  | DtWidthType | width ) const

Gets month strings by width and context.

For example: "January", "February", etc.

Parameters

  count | Filled in with length of the array.
  context | The formatting context, either FORMAT or STANDALONE
  width | The width of returned strings, either WIDE, ABBREVIATED, or NARROW.

Returns
  the month strings. (DateFormatSymbols retains ownership.)

Stable
  ICU 3.4

References U_I18N_API.

## getNarrowEras()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getNarrowEras | ( | int32_t & | count | ) | const

Gets narrow era strings.

For example: "A" and "B".

Parameters

  count | Filled in with length of the array.

Returns
  the narrow era strings.

Stable
  ICU 4.2

References U_I18N_API.

## getPatternUChars()

U_I18N_API const char16_t * icu::DateFormatSymbols::getPatternUChars | ( |  | ) |

static

Get the non-localized date-time pattern characters.

Returns
  the non-localized date-time pattern characters

Stable
  ICU 2.0

References U_I18N_API.

## getQuarters()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getQuarters | ( | int32_t & | count,
|  | DtContextType | context,
|  | DtWidthType | width ) const

Gets quarter strings by width and context.

For example: "1st Quarter", "2nd Quarter", etc.

Parameters

  count | Filled in with length of the array.
  context | The formatting context, either FORMAT or STANDALONE
  width | The width of returned strings, either WIDE, ABBREVIATED, or NARROW.

Returns
  the quarter strings. (DateFormatSymbols retains ownership.)

Stable
  ICU 3.6

References U_I18N_API.

## getShortMonths()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getShortMonths | ( | int32_t & | count | ) | const

Gets short month strings.

For example: "Jan", "Feb", etc.

Parameters

  count | Filled in with length of the array.

Returns
  the short month strings. (DateFormatSymbols retains ownership.)

Stable
  ICU 2.0

References U_I18N_API.

## getShortWeekdays()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getShortWeekdays | ( | int32_t & | count | ) | const

Gets abbreviated weekday strings.

For example: "Sun", "Mon", etc. (Note: The method name is misleading; it does not get the CLDR-style "short" weekday strings, e.g. "Su", "Mo", etc.)

Parameters

  count | Filled in with length of the array.

Returns
  the abbreviated weekday strings. (DateFormatSymbols retains ownership.)

Stable
  ICU 2.0

References U_I18N_API.

## getStaticClassID()

U_I18N_API UClassID icu::DateFormatSymbols::getStaticClassID | ( |  | ) |

static

ICU "poor man's RTTI", returns a UClassID for this class.

Stable
  ICU 2.2

References DateFormatSymbols(), and U_I18N_API.

## getTimeSeparatorString()

U_I18N_API UnicodeString & icu::DateFormatSymbols::getTimeSeparatorString | ( | UnicodeString & | result | ) | const

Gets the time separator string.

For example: ":".

Parameters

  result | Output param which will receive the time separator string.

Returns
  A reference to 'result'.

Internal
  Do not use. This API is for internal use only.

References U_I18N_API.

## getWeekdays() [1/2]

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getWeekdays | ( | int32_t & | count | ) | const

Gets wide weekday strings.

For example: "Sunday", "Monday", etc.

Parameters

  count | Filled in with length of the array.

Returns
  the weekday strings. (DateFormatSymbols retains ownership.)

Stable
  ICU 2.0

References U_I18N_API.

## getWeekdays() [2/2]

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getWeekdays | ( | int32_t & | count,
|  | DtContextType | context,
|  | DtWidthType | width ) const

Gets weekday strings by width and context.

For example: "Sunday", "Monday", etc.

Parameters

  count | Filled in with length of the array.
  context | The formatting context, either FORMAT or STANDALONE
  width | The width of returned strings, either WIDE, ABBREVIATED, SHORT, or NARROW

Returns
  the month strings. (DateFormatSymbols retains ownership.)

Stable
  ICU 3.4

References U_I18N_API.

## getYearNames()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getYearNames | ( | int32_t & | count,
|  | DtContextType | context,
|  | DtWidthType | width ) const

Gets cyclic year name strings if the calendar has them, by width and context.

For example: "jia-zi", "yi-chou", etc.

Parameters

  count | Filled in with length of the array.
  context | The usage context: FORMAT, STANDALONE.
  width | The requested name width: WIDE, ABBREVIATED, NARROW.

Returns
  The year name strings (DateFormatSymbols retains ownership), or null if they are not available for this calendar.

Stable
  ICU 54

References U_I18N_API.

## getZodiacNames()

U_I18N_API const UnicodeString * icu::DateFormatSymbols::getZodiacNames | ( | int32_t & | count,
|  | DtContextType | context,
|  | DtWidthType | width ) const

Gets calendar zodiac name strings if the calendar has them, by width and context.

For example: "Rat", "Ox", "Tiger", etc.

Parameters

  count | Filled in with length of the array.
  context | The usage context: FORMAT, STANDALONE.
  width | The requested name width: WIDE, ABBREVIATED, NARROW.

Returns
  The zodiac name strings (DateFormatSymbols retains ownership), or null if they are not available for this calendar.

Stable
  ICU 54

References U_I18N_API.

## getZoneStrings()

U_I18N_API const UnicodeString ** icu::DateFormatSymbols::getZoneStrings | ( | int32_t & | rowCount,
|  | int32_t & | columnCount ) const

Gets timezone strings.

These strings are stored in a 2-dimensional array.

Parameters

  rowCount | Output param to receive number of rows.
  columnCount | Output param to receive number of columns.

Returns
  The timezone strings as a 2-d array. (DateFormatSymbols retains ownership.)

Deprecated
  ICU 3.6

References U_I18N_API.

## operator!=()

U_I18N_API bool icu::DateFormatSymbols::operator!= | ( | const DateFormatSymbols & | other | ) | const

inline

Return true if another object is semantically unequal to this one.

Parameters

  other | the DateFormatSymbols object to be compared with.

Returns
  true if other is semantically unequal to this.

Stable
  ICU 2.0

Definition at line 183 of file dtfmtsym.h.

References DateFormatSymbols(), icu::operator==(), and U_I18N_API.

## operator=()

U_I18N_API DateFormatSymbols & icu::DateFormatSymbols::operator= | ( | const DateFormatSymbols & |  | ) |

Assignment operator.

Stable
  ICU 2.0

References DateFormatSymbols(), and U_I18N_API.

## operator==()

U_I18N_API bool icu::DateFormatSymbols::operator== | ( | const DateFormatSymbols & | other | ) | const

Return true if another object is semantically equal to this one.

Parameters

  other | the DateFormatSymbols object to be compared with.

Returns
  true if other is semantically equal to this.

Stable
  ICU 2.0

References DateFormatSymbols(), and U_I18N_API.

## setAmPmStrings() [1/2]

U_I18N_API void icu::DateFormatSymbols::setAmPmStrings | ( | const UnicodeString * | ampms,
|  | int32_t | count )

Sets ampm strings.

For example: "AM" and "PM".

Parameters

  ampms | The new ampm strings. (not adopted; caller retains ownership)
  count | The number of strings in the array.

Stable
  ICU 2.0

References U_I18N_API.

## setAmPmStrings() [2/2]

U_I18N_API void icu::DateFormatSymbols::setAmPmStrings | ( | const UnicodeString * | ampms,
|  | int32_t | count,
|  | DtContextType | context,
|  | DtWidthType | width )

Sets AM/PM strings with the specified width.

For example: "A" and "P".

Parameters

  ampms | The new AM/PM strings. (not adopted; caller retains ownership)
  count | The number of strings in the array.
  context | The usage context. Currently ignored; always sets FORMAT names.
  width | The width of set strings, either WIDE, ABBREVIATED, or NARROW.

Draft
  This API may be changed in the future versions and was introduced in ICU 78

References U_I18N_API.

## setEraNames()

U_I18N_API void icu::DateFormatSymbols::setEraNames | ( | const UnicodeString * | eraNames,
|  | int32_t | count )

Sets era name strings.

For example: "Anno Domini" and "Before Christ".

Parameters

  eraNames | Array of era name strings (DateFormatSymbols retains ownership.)
  count | Filled in with length of the array.

Stable
  ICU 3.6

References U_I18N_API.

## setEras()

U_I18N_API void icu::DateFormatSymbols::setEras | ( | const UnicodeString * | eras,
|  | int32_t | count )

Sets abbreviated era strings.

For example: "AD" and "BC".

Parameters

  eras | Array of era strings (DateFormatSymbols retains ownership.)
  count | Filled in with length of the array.

Stable
  ICU 2.0

References U_I18N_API.

## setLocalPatternChars()

U_I18N_API void icu::DateFormatSymbols::setLocalPatternChars | ( | const UnicodeString & | newLocalPatternChars | ) |

Sets localized date-time pattern characters.

For example: 'u', 't', etc.

Parameters

  newLocalPatternChars | the new localized date-time pattern characters.

Stable
  ICU 2.0

References U_I18N_API.

## setMonths() [1/2]

U_I18N_API void icu::DateFormatSymbols::setMonths | ( | const UnicodeString * | months,
|  | int32_t | count )

Sets month strings.

For example: "January", "February", etc.

Parameters

  months | the new month strings. (not adopted; caller retains ownership)
  count | Filled in with length of the array.

Stable
  ICU 2.0

References U_I18N_API.

## setMonths() [2/2]

U_I18N_API void icu::DateFormatSymbols::setMonths | ( | const UnicodeString * | months,
|  | int32_t | count,
|  | DtContextType | context,
|  | DtWidthType | width )

Sets month strings by width and context.

For example: "January", "February", etc.

Parameters

  months | The new month strings. (not adopted; caller retains ownership)
  count | Filled in with length of the array.
  context | The formatting context, either FORMAT or STANDALONE
  width | The width of returned strings, either WIDE, ABBREVIATED, or NARROW.

Stable
  ICU 3.6

References U_I18N_API.

## setNarrowEras()

U_I18N_API void icu::DateFormatSymbols::setNarrowEras | ( | const UnicodeString * | narrowEras,
|  | int32_t | count )

Sets narrow era strings.

For example: "A" and "B".

Parameters

  narrowEras | Array of narrow era strings (DateFormatSymbols retains ownership.)
  count | Filled in with length of the array.

Stable
  ICU 4.2

References U_I18N_API.

## setQuarters()

U_I18N_API void icu::DateFormatSymbols::setQuarters | ( | const UnicodeString * | quarters,
|  | int32_t | count,
|  | DtContextType | context,
|  | DtWidthType | width )

Sets quarter strings by width and context.

For example: "1st Quarter", "2nd Quarter", etc.

Parameters

  quarters | The new quarter strings. (not adopted; caller retains ownership)
  count | The number of strings in the array.
  context | The formatting context, either FORMAT or STANDALONE
  width | The width of set strings, either WIDE, ABBREVIATED, or NARROW.

Stable
  ICU 3.6

References U_I18N_API.

## setShortMonths()

U_I18N_API void icu::DateFormatSymbols::setShortMonths | ( | const UnicodeString * | shortMonths,
|  | int32_t | count )

Sets short month strings.

For example: "Jan", "Feb", etc.

Parameters

  count | Filled in with length of the array.
  shortMonths | the new short month strings. (not adopted; caller retains ownership)

Stable
  ICU 2.0

References U_I18N_API.

## setShortWeekdays()

U_I18N_API void icu::DateFormatSymbols::setShortWeekdays | ( | const UnicodeString * | abbrevWeekdays,
|  | int32_t | count )

Sets abbreviated weekday strings.

For example: "Sun", "Mon", etc. (Note: The method name is misleading; it does not set the CLDR-style "short" weekday strings, e.g. "Su", "Mo", etc.)

Parameters

  abbrevWeekdays | the new abbreviated weekday strings. (not adopted; caller retains ownership)
  count | Filled in with length of the array.

Stable
  ICU 2.0

References U_I18N_API.

## setTimeSeparatorString()

U_I18N_API void icu::DateFormatSymbols::setTimeSeparatorString | ( | const UnicodeString & | newTimeSeparator | ) |

Sets the time separator string.

For example: ":".

Parameters

  newTimeSeparator | the new time separator string.

Internal
  Do not use. This API is for internal use only.

References U_I18N_API.

## setWeekdays() [1/2]

U_I18N_API void icu::DateFormatSymbols::setWeekdays | ( | const UnicodeString * | weekdays,
|  | int32_t | count )

Sets wide weekday strings.

For example: "Sunday", "Monday", etc.

Parameters

  weekdays | the new weekday strings. (not adopted; caller retains ownership)
  count | Filled in with length of the array.

Stable
  ICU 2.0

References U_I18N_API.

## setWeekdays() [2/2]

U_I18N_API void icu::DateFormatSymbols::setWeekdays | ( | const UnicodeString * | weekdays,
|  | int32_t | count,
|  | DtContextType | context,
|  | DtWidthType | width )

Sets weekday strings by width and context.

For example: "Sunday", "Monday", etc.

Parameters

  weekdays | The new weekday strings. (not adopted; caller retains ownership)
  count | Filled in with length of the array.
  context | The formatting context, either FORMAT or STANDALONE
  width | The width of returned strings, either WIDE, ABBREVIATED, SHORT, or NARROW

Stable
  ICU 3.6

References U_I18N_API.

## setYearNames()

U_I18N_API void icu::DateFormatSymbols::setYearNames | ( | const UnicodeString * | yearNames,
|  | int32_t | count,
|  | DtContextType | context,
|  | DtWidthType | width )

Sets cyclic year name strings by width and context.

For example: "jia-zi", "yi-chou", etc.

Parameters

  yearNames | The new cyclic year name strings (not adopted; caller retains ownership).
  count | The length of the array.
  context | The usage context: FORMAT, STANDALONE (currently only FORMAT is supported).
  width | The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported).

Stable
  ICU 54

References U_I18N_API.

## setZodiacNames()

U_I18N_API void icu::DateFormatSymbols::setZodiacNames | ( | const UnicodeString * | zodiacNames,
|  | int32_t | count,
|  | DtContextType | context,
|  | DtWidthType | width )

Sets calendar zodiac name strings by width and context.

For example: "Rat", "Ox", "Tiger", etc.

Parameters

  zodiacNames | The new zodiac name strings (not adopted; caller retains ownership).
  count | The length of the array.
  context | The usage context: FORMAT, STANDALONE (currently only FORMAT is supported).
  width | The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported).

Stable
  ICU 54

References U_I18N_API.

## setZoneStrings()

U_I18N_API void icu::DateFormatSymbols::setZoneStrings | ( | const UnicodeString *const * | strings,
|  | int32_t | rowCount,
|  | int32_t | columnCount )

Sets timezone strings.

These strings are stored in a 2-dimensional array.

Note: SimpleDateFormat no longer use the zone strings stored in a DateFormatSymbols. Therefore, the time zone strings set by this method have no effects in an instance of SimpleDateFormat for formatting time zones.

Parameters

  strings | The timezone strings as a 2-d array to be copied. (not adopted; caller retains ownership)
  rowCount | The number of rows (count of first index).
  columnCount | The number of columns (count of second index).

Stable
  ICU 2.0

References U_I18N_API.

## Friends And Related Symbol Documentation

## DateFormatSymbolsSingleSetter

friend class DateFormatSymbolsSingleSetter

friend

Definition at line 689 of file dtfmtsym.h.

## SimpleDateFormat

friend class SimpleDateFormat

friend

Definition at line 688 of file dtfmtsym.h.

## Field Documentation

## ALTERNATE_TIME_SEPARATOR

U_I18N_API const char16_t icu::DateFormatSymbols::ALTERNATE_TIME_SEPARATOR = 0x002e

static

This alternate time separator is always recognized when parsing.

Internal
  Do not use. This API is for internal use only.

Definition at line 474 of file dtfmtsym.h.

## DEFAULT_TIME_SEPARATOR

U_I18N_API const char16_t icu::DateFormatSymbols::DEFAULT_TIME_SEPARATOR = 0x003a

static

This default time separator is used for formatting when the locale doesn't specify any time separator, and always recognized when parsing.

Internal
  Do not use. This API is for internal use only.

Definition at line 468 of file dtfmtsym.h.

The documentation for this class was generated from the following file:

- i18n/unicode/dtfmtsym.h