Class ChineseDateFormat

All Implemented Interfaces:
Serializable, Cloneable

@Deprecated public class ChineseDateFormat extends SimpleDateFormat
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:
  • Constructor Details

    • ChineseDateFormat

      @Deprecated public ChineseDateFormat(String pattern, Locale locale)
      Deprecated.
      ICU 50
      Construct a ChineseDateFormat from a date format pattern and locale
      Parameters:
      pattern - the pattern
      locale - the locale
    • ChineseDateFormat

      @Deprecated public ChineseDateFormat(String pattern, ULocale locale)
      Deprecated.
      ICU 50
      Construct a ChineseDateFormat from a date format pattern and locale
      Parameters:
      pattern - the pattern
      locale - the locale
    • ChineseDateFormat

      @Deprecated 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 - the pattern
      override - 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 class SimpleDateFormat
    • subParse

      @Deprecated protected int subParse(String text, int start, char ch, int count, boolean obeyCount, boolean allowNegative, boolean[] ambiguousYear, Calendar cal)
      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.
      Overrides:
      subParse in class SimpleDateFormat
      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 protected DateFormat.Field patternCharToDateFormatField(char ch)
      Deprecated.
      ICU 50
      Returns a DateFormat.Field constant associated with the specified format pattern character.
      Overrides:
      patternCharToDateFormatField in class SimpleDateFormat
      Parameters:
      ch - The pattern character
      Returns:
      DateFormat.Field associated with the pattern character