Package com.ibm.icu.text
Class ChineseDateFormat
java.lang.Object
java.text.Format
com.ibm.icu.text.UFormat
com.ibm.icu.text.DateFormat
com.ibm.icu.text.SimpleDateFormat
com.ibm.icu.text.ChineseDateFormat
- All Implemented Interfaces:
Serializable
,Cloneable
Deprecated.
ICU 50 Use SimpleDateFormat instead.
A concrete
DateFormat
for 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:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.ibm.icu.text.DateFormat
DateFormat.BooleanAttribute, DateFormat.HourCycle
Nested classes/interfaces inherited from class com.ibm.icu.text.UFormat
UFormat.SpanField
-
Field Summary
Fields inherited from class com.ibm.icu.text.DateFormat
ABBR_GENERIC_TZ, ABBR_MONTH, ABBR_MONTH_DAY, ABBR_MONTH_WEEKDAY_DAY, ABBR_QUARTER, ABBR_SPECIFIC_TZ, ABBR_STANDALONE_MONTH, ABBR_UTC_TZ, ABBR_WEEKDAY, AM_PM_FIELD, AM_PM_MIDNIGHT_NOON_FIELD, calendar, DATE_FIELD, DATE_SKELETONS, DAY, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, DOW_LOCAL_FIELD, ERA_FIELD, EXTENDED_YEAR_FIELD, FIELD_COUNT, FLEXIBLE_DAY_PERIOD_FIELD, FRACTIONAL_SECOND_FIELD, FULL, GENERIC_TZ, HOUR, HOUR_GENERIC_TZ, HOUR_MINUTE, HOUR_MINUTE_GENERIC_TZ, HOUR_MINUTE_SECOND, HOUR_MINUTE_TZ, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR_TZ, HOUR0_FIELD, HOUR1_FIELD, HOUR24, HOUR24_MINUTE, HOUR24_MINUTE_SECOND, JP_ERA_2019_JA, JP_ERA_2019_NARROW, JP_ERA_2019_ROOT, JULIAN_DAY_FIELD, LOCATION_TZ, LONG, MEDIUM, MILLISECOND_FIELD, MILLISECONDS_IN_DAY_FIELD, MINUTE, MINUTE_FIELD, MINUTE_SECOND, MONTH, MONTH_DAY, MONTH_FIELD, MONTH_WEEKDAY_DAY, NONE, NUM_MONTH, NUM_MONTH_DAY, NUM_MONTH_WEEKDAY_DAY, numberFormat, QUARTER, QUARTER_FIELD, RELATIVE, RELATIVE_DEFAULT, RELATIVE_FULL, RELATIVE_LONG, RELATIVE_MEDIUM, RELATIVE_SHORT, SECOND, SECOND_FIELD, SHORT, SPECIFIC_TZ, STANDALONE_DAY_FIELD, STANDALONE_MONTH, STANDALONE_MONTH_FIELD, STANDALONE_QUARTER_FIELD, TIME_SEPARATOR, TIME_SKELETONS, TIMEZONE_FIELD, TIMEZONE_GENERIC_FIELD, TIMEZONE_ISO_FIELD, TIMEZONE_ISO_LOCAL_FIELD, TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD, TIMEZONE_RFC_FIELD, TIMEZONE_SPECIAL_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, WEEKDAY, YEAR, YEAR_ABBR_MONTH, YEAR_ABBR_MONTH_DAY, YEAR_ABBR_MONTH_WEEKDAY_DAY, YEAR_ABBR_QUARTER, YEAR_FIELD, YEAR_MONTH, YEAR_MONTH_DAY, YEAR_MONTH_WEEKDAY_DAY, YEAR_NAME_FIELD, YEAR_NUM_MONTH, YEAR_NUM_MONTH_DAY, YEAR_NUM_MONTH_WEEKDAY_DAY, YEAR_QUARTER, YEAR_WOY_FIELD, ZONE_SKELETONS
-
Constructor Summary
ConstructorsConstructorDescriptionChineseDateFormat
(String pattern, ULocale locale) Deprecated.ICU 50ChineseDateFormat
(String pattern, String override, ULocale locale) Deprecated.ICU 50ChineseDateFormat
(String pattern, Locale locale) Deprecated.ICU 50 -
Method Summary
Modifier and TypeMethodDescriptionprotected DateFormat.Field
patternCharToDateFormatField
(char ch) Deprecated.ICU 50protected void
subFormat
(StringBuffer buf, char ch, int count, int beginOffset, int fieldNum, DisplayContext capitalizationContext, FieldPosition pos, char patternCharToOutput, Calendar cal) Deprecated.This API is ICU internal only.protected int
subParse
(String text, int start, char ch, int count, boolean obeyCount, boolean allowNegative, boolean[] ambiguousYear, Calendar cal) Deprecated.ICU 50Methods inherited from class com.ibm.icu.text.SimpleDateFormat
applyLocalizedPattern, applyPattern, clone, equals, format, formatToCharacterIterator, get2DigitYearStart, getDateFormatSymbols, getInstance, getNumberFormat, getSymbols, getTimeZoneFormat, hashCode, intervalFormatByAlgorithm, matchQuarterString, matchString, parse, set2DigitYearStart, setContext, setDateFormatSymbols, setNumberFormat, setNumberFormat, setTimeZoneFormat, subFormat, subFormat, toLocalizedPattern, toPattern, zeroPaddingNumber, zeroPaddingNumber
Methods inherited from class com.ibm.icu.text.DateFormat
format, format, format, getAvailableLocales, getAvailableULocales, getBooleanAttribute, getCalendar, getContext, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getInstance, getInstance, getInstance, getInstanceForSkeleton, getInstanceForSkeleton, getInstanceForSkeleton, getInstanceForSkeleton, getInstanceForSkeleton, getNumberFormat, getPatternInstance, getPatternInstance, getPatternInstance, getPatternInstance, getPatternInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isCalendarLenient, isLenient, parse, parse, parseObject, setBooleanAttribute, setCalendar, setCalendarLenient, setLenient, setTimeZone
Methods inherited from class java.text.Format
format, parseObject
-
Constructor Details
-
ChineseDateFormat
Deprecated.ICU 50Construct a ChineseDateFormat from a date format pattern and locale- Parameters:
pattern
- the patternlocale
- the locale
-
ChineseDateFormat
Deprecated.ICU 50Construct a ChineseDateFormat from a date format pattern and locale- Parameters:
pattern
- the patternlocale
- the locale
-
ChineseDateFormat
Deprecated.ICU 50Construct a ChineseDateFormat from a date format pattern, numbering system override and locale- Parameters:
pattern
- the patternoverride
- 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
- the locale
-
-
Method Details
-
subFormat
@Deprecated protected void subFormat(StringBuffer buf, char ch, int count, int beginOffset, int fieldNum, DisplayContext capitalizationContext, FieldPosition pos, char patternCharToOutput, Calendar cal) 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.- Overrides:
subFormat
in classSimpleDateFormat
-
subParse
@Deprecated protected int subParse(String text, int start, char ch, int count, boolean obeyCount, boolean allowNegative, boolean[] ambiguousYear, Calendar cal) Deprecated.ICU 50Protected method that converts one field of the input string into a numeric field value incal
. Returns -start (for ParsePosition) if failed. Subclasses may override this method to modify or add parsing capabilities.- Overrides:
subParse
in classSimpleDateFormat
- Parameters:
text
- the time text to be parsed.start
- where to start parsing.ch
- the pattern character for the date field text to be parsed.count
- the count of a pattern character.obeyCount
- if true, then the next field directly abuts this one, and we should use the count to know when to stop parsing.ambiguousYear
- return parameter; upon return, if ambiguousYear[0] is true, then a two-digit year was parsed and may need to be readjusted.cal
-- Returns:
- 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.
-
patternCharToDateFormatField
Deprecated.ICU 50Returns a DateFormat.Field constant associated with the specified format pattern character.- Overrides:
patternCharToDateFormatField
in classSimpleDateFormat
- Parameters:
ch
- The pattern character- Returns:
- DateFormat.Field associated with the pattern character
-