Top Description Inners Fields Constructors Methods
com.ibm.icu.text

public Class ChineseDateFormat

extends SimpleDateFormat
Class Inheritance
Annotations
@Deprecated
Imports
java.io.InvalidObjectException, java.text.FieldPosition, java.util.Locale, com.ibm.icu.util.Calendar, .ChineseCalendar, .TimeZone, .ULocale

Deprecated

ICU 50 Use SimpleDateFormat instead.

A concrete DateFormat for com.ibm.icu.util.ChineseCalendar. This class handles a ChineseCalendar-specific field, ChineseCalendar.IS_LEAP_MONTH. It also redefines the handling of two fields, ERA and YEAR. The former is displayed numerically, instead of symbolically, since it is the numeric cycle number in ChineseCalendar. The latter is numeric, as before, but has no special 2-digit Y2K behavior.

With regard to ChineseCalendar.IS_LEAP_MONTH, this class handles parsing specially. If no string symbol is found at all, this is taken as equivalent to an IS_LEAP_MONTH value of zero. This allows formats to display a special string (e.g., "*") for leap months, but no string for normal months.

Summary of field changes vs. SimpleDateFormat:

Symbol   Meaning                 Presentation        Example
------   -------                 ------------        -------
G        cycle                   (Number)            78
y        year of cycle (1..60)   (Number)            17
l        is leap month           (Text)              4637
Author
Alan Liu
See Also
com.ibm.icu.util.ChineseCalendar, ChineseDateFormatSymbols

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ChineseDateFormat.Field

Deprecated ICU 50
The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that ChineseDateFormat.formatToCharacterIterator() method returns.

Field Summary

Modifier and TypeField and Description
pack-priv static final long
Inherited from com.ibm.icu.text.SimpleDateFormat:
currentSerialVersionDATE_PATTERN_TYPEDelayedHebrewMonthCheck

Constructor Summary

AccessConstructor and Description
public
ChineseDateFormat(String
the pattern
pattern
,
Locale
the locale
locale
)

Deprecated ICU 50
Construct a ChineseDateFormat from a date format pattern and locale
public
ChineseDateFormat(String
the pattern
pattern
,
ULocale
the locale
locale
)

Deprecated ICU 50
Construct a ChineseDateFormat from a date format pattern and locale
public
ChineseDateFormat(String
the pattern
pattern
,
String
The override string. A numbering system override string can take one of the following forms: 1). If just a numbering system name is specified, it applies to all numeric fields in the date format pattern. 2). To specify an alternate numbering system on a field by field basis, use the field letters from the pattern followed by an = sign, followed by the numbering system name. For example, to specify that just the year be formatted using Hebrew digits, use the override "y=hebr". Multiple overrides can be specified in a single string by separating them with a semi-colon. For example, the override string "m=thai;y=deva" would format using Thai digits for the month and Devanagari digits for the year.
override
,
ULocale
the locale
locale
)

Deprecated ICU 50
Construct a ChineseDateFormat from a date format pattern, numbering system override and locale

Method Summary

Modifier and TypeMethod and Description
protected DateFormat.Field
patternCharToDateFormatField(char
The pattern character
ch
)

Overrides com.ibm.icu.text.SimpleDateFormat.patternCharToDateFormatField.

Deprecated ICU 50
Returns a DateFormat.Field constant associated with the specified format pattern character.
protected void
subFormat(StringBuffer buf, char ch, int count, int beginOffset, int fieldNum, DisplayContext capitalizationContext, FieldPosition pos, char patternCharToOutput, Calendar cal)

Overrides com.ibm.icu.text.SimpleDateFormat.subFormat.

Deprecated This API is ICU internal only.
Formats a single field; useFastFormat variant.
protected int
subParse(String
the time text to be parsed.
text
,
int
where to start parsing.
start
,
char
the pattern character for the date field text to be parsed.
ch
,
int
the count of a pattern character.
count
,
boolean
if true, then the next field directly abuts this one, and we should use the count to know when to stop parsing.
obeyCount
,
boolean allowNegative, boolean[]
return parameter; upon return, if ambiguousYear[0] is true, then a two-digit year was parsed and may need to be readjusted.
ambiguousYear
,
Calendar cal)

Overrides com.ibm.icu.text.SimpleDateFormat.subParse.

Deprecated ICU 50
Protected method that converts one field of the input string into a numeric field value in cal.
Inherited from com.ibm.icu.text.SimpleDateFormat:
applyLocalizedPatternapplyPatterncloneequalsformatformatformatToCharacterIteratorget2DigitYearStartgetDateFormatSymbolsgetInstancegetLocalegetNumberFormatgetSymbolsgetTimeZoneFormathashCodeintervalFormatByAlgorithmisFieldUnitIgnoredisFieldUnitIgnoredmatchQuarterStringmatchStringparseset2DigitYearStartsetContextsetDateFormatSymbolssetNumberFormatsetNumberFormatsetTimeZoneFormatsubFormatsubFormattoLocalizedPatterntoPatternzeroPaddingNumberzeroPaddingNumber

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.ibm.icu.text.SimpleDateFormat.serialVersionUID.

Constructor Detail

ChineseDateFormatback to summary
public ChineseDateFormat(String pattern, Locale locale)

Deprecated

ICU 50

Construct a ChineseDateFormat from a date format pattern and locale

Parameters
pattern:String

the pattern

locale:Locale

the locale

Annotations
@Deprecated
ChineseDateFormatback to summary
public ChineseDateFormat(String pattern, ULocale locale)

Deprecated

ICU 50

Construct a ChineseDateFormat from a date format pattern and locale

Parameters
pattern:String

the pattern

locale:ULocale

the locale

Annotations
@Deprecated
ChineseDateFormatback to summary
public ChineseDateFormat(String pattern, String override, ULocale locale)

Deprecated

ICU 50

Construct a ChineseDateFormat from a date format pattern, numbering system override and locale

Parameters
pattern:String

the pattern

override:String

The override string. A numbering system override string can take one of the following forms: 1). If just a numbering system name is specified, it applies to all numeric fields in the date format pattern. 2). To specify an alternate numbering system on a field by field basis, use the field letters from the pattern followed by an = sign, followed by the numbering system name. For example, to specify that just the year be formatted using Hebrew digits, use the override "y=hebr". Multiple overrides can be specified in a single string by separating them with a semi-colon. For example, the override string "m=thai;y=deva" would format using Thai digits for the month and Devanagari digits for the year.

locale:ULocale

the locale

Annotations
@Deprecated

Method Detail

patternCharToDateFormatFieldback to summary
protected DateFormat.Field patternCharToDateFormatField(char ch)

Overrides com.ibm.icu.text.SimpleDateFormat.patternCharToDateFormatField.

Doc from com.ibm.icu.text.SimpleDateFormat.patternCharToDateFormatField.

Deprecated

ICU 50

Returns a DateFormat.Field constant associated with the specified format pattern character.

Parameters
ch:char

The pattern character

Returns:DateFormat.Field

DateFormat.Field associated with the pattern character

Annotations
@Override
@Deprecated
subFormatback to summary
protected void subFormat(StringBuffer buf, char ch, int count, int beginOffset, int fieldNum, DisplayContext capitalizationContext, FieldPosition pos, char patternCharToOutput, Calendar cal)

Overrides com.ibm.icu.text.SimpleDateFormat.subFormat.

Doc from com.ibm.icu.text.SimpleDateFormat.subFormat.

Deprecated

This API is ICU internal only.

Formats a single field; useFastFormat variant. Reuses a StringBuffer for results instead of creating a String on the heap for each call. NOTE We don't really need the beginOffset parameter, EXCEPT for the need to support the slow subFormat variant (above) which has to pass it in to us.

Annotations
@Override
@Deprecated
ICU Status
Internal ICU component.
subParseback to summary
protected int subParse(String text, int start, char ch, int count, boolean obeyCount, boolean allowNegative, boolean[] ambiguousYear, Calendar cal)

Overrides com.ibm.icu.text.SimpleDateFormat.subParse.

Doc from com.ibm.icu.text.SimpleDateFormat.subParse.

Deprecated

ICU 50

Protected method that converts one field of the input string into a numeric field value in cal. Returns -start (for ParsePosition) if failed. Subclasses may override this method to modify or add parsing capabilities.

Parameters
text:String

the time text to be parsed.

start:int

where to start parsing.

ch:char

the pattern character for the date field text to be parsed.

count:int

the count of a pattern character.

obeyCount:boolean

if true, then the next field directly abuts this one, and we should use the count to know when to stop parsing.

ambiguousYear:boolean[]

return parameter; upon return, if ambiguousYear[0] is true, then a two-digit year was parsed and may need to be readjusted.

Returns:int

the new start position if matching succeeded; a negative number indicating matching failure, otherwise. As a side effect, set the appropriate field of cal with the parsed value.

Annotations
@Deprecated
@Override
com.ibm.icu.text back to summary

public Class ChineseDateFormat.Field

extends Field
Class Inheritance
Annotations
@Deprecated

Deprecated

ICU 50

The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that ChineseDateFormat.formatToCharacterIterator() method returns.

There is no public constructor to this class, the only instances are the constants defined here.

Field Summary

Modifier and TypeField and Description
public static final ChineseDateFormat.Field
IS_LEAP_MONTH

Constant identifying the leap month marker.

private static final long
Inherited from com.ibm.icu.text.DateFormat.Field:
AM_PMAM_PM_MIDNIGHT_NOONDAY_OF_MONTHDAY_OF_WEEKDAY_OF_WEEK_IN_MONTHDAY_OF_YEARDOW_LOCALERAEXTENDED_YEARFLEXIBLE_DAY_PERIODHOUR0HOUR1HOUR_OF_DAY0HOUR_OF_DAY1JULIAN_DAYMILLISECONDMILLISECONDS_IN_DAYMINUTEMONTHQUARTERRELATED_YEARSECONDTIME_SEPARATORTIME_ZONEWEEK_OF_MONTHWEEK_OF_YEARYEARYEAR_WOY

Constructor Summary

AccessConstructor and Description
protected
Field(String
Name of the attribute
name
,
int
Calendar field constant
calendarField
)

Deprecated ICU 50
Constructs a ChineseDateFormat.Field with the given name and the ChineseCalendar field which this attribute represents.

Method Summary

Modifier and TypeMethod and Description
public static DateFormat.Field

Returns:

Field associated with the calendarField, or null if no associated Field is available.
ofCalendarField
(int
ChineseCalendar field constant
calendarField
)

Hides com.ibm.icu.text.DateFormat.Field.ofCalendarField.

Deprecated ICU 50
Returns the Field constant that corresponds to the ChineseCalendar field calendarField.
protected Object
readResolve()

Overrides com.ibm.icu.text.DateFormat.Field.readResolve.

Deprecated ICU 50
Resolves instances being deserialized to the predefined constants.
Inherited from com.ibm.icu.text.DateFormat.Field:
getCalendarField

Field Detail

IS_LEAP_MONTHback to summary
public static final ChineseDateFormat.Field IS_LEAP_MONTH

Deprecated

ICU 50 This field is only used by the deprecated ChineseDateFormat class.

Constant identifying the leap month marker.

Annotations
@Deprecated
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.ibm.icu.text.DateFormat.Field.serialVersionUID.

Constructor Detail

Fieldback to summary
protected Field(String name, int calendarField)

Deprecated

ICU 50

Constructs a ChineseDateFormat.Field with the given name and the ChineseCalendar field which this attribute represents. Use -1 for calendarField if this field does not have a corresponding ChineseCalendar field.

Parameters
name:String

Name of the attribute

calendarField:int

Calendar field constant

Annotations
@Deprecated

Method Detail

ofCalendarFieldback to summary
public static DateFormat.Field ofCalendarField(int calendarField)

Hides com.ibm.icu.text.DateFormat.Field.ofCalendarField.

Deprecated

ICU 50

Returns the Field constant that corresponds to the ChineseCalendar field calendarField. If there is no corresponding Field is available, null is returned.

Parameters
calendarField:int

ChineseCalendar field constant

Returns:DateFormat.Field

Field associated with the calendarField, or null if no associated Field is available.

Annotations
@Deprecated
Exceptions
IllegalArgumentException:
if calendarField is not a valid Calendar field constant.
readResolveback to summary
protected Object readResolve() throws InvalidObjectException

Overrides com.ibm.icu.text.DateFormat.Field.readResolve.

Doc from com.ibm.icu.text.DateFormat.Field.readResolve.

Deprecated

ICU 50

Resolves instances being deserialized to the predefined constants.

Returns:Object

Doc from java.text.AttributedCharacterIterator.Attribute.readResolve.

the resolved Attribute object

Annotations
@Override
@Deprecated
Exceptions
InvalidObjectException:
if the constant could not be resolved.