com.ibm.icu.text

Class ChineseDateFormat


public class ChineseDateFormat
extends SimpleDateFormat

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:
ChineseCalendar, ChineseDateFormatSymbols

Field Summary

Fields inherited from class com.ibm.icu.text.DateFormat

AM_PM_FIELD, DATE_FIELD, 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, FRACTIONAL_SECOND_FIELD, FULL, HOUR0_FIELD, HOUR1_FIELD, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, JULIAN_DAY_FIELD, LONG, MEDIUM, MILLISECONDS_IN_DAY_FIELD, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, SECOND_FIELD, SHORT, STANDALONE_DAY_FIELD, STANDALONE_MONTH_FIELD, TIMEZONE_FIELD, TIMEZONE_GENERIC_FIELD, TIMEZONE_RFC_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD, YEAR_WOY_FIELD, calendar, numberFormat

Constructor Summary

ChineseDateFormat(String pattern, Locale locale)
Construct a ChineseDateFormat from a date format pattern and locale
ChineseDateFormat(String pattern, ULocale locale)
Construct a ChineseDateFormat from a date format pattern and locale

Method Summary

protected void
subFormat(StringBuffer buf, char ch, int count, int beginOffset, FieldPosition pos, Calendar cal)
protected int
subParse(String text, int start, char ch, int count, boolean obeyCount, boolean allowNegative, boolean[] ambiguousYear, Calendar cal)

Methods inherited from class com.ibm.icu.text.SimpleDateFormat

applyLocalizedPattern, applyPattern, clone, equals, format, get2DigitYearStart, getDateFormatSymbols, getSymbols, hashCode, matchString, parse, set2DigitYearStart, setDateFormatSymbols, subFormat, subFormat, subParse, toLocalizedPattern, toPattern, zeroPaddingNumber, zeroPaddingNumber

Methods inherited from class com.ibm.icu.text.DateFormat

clone, equals, format, format, format, format, getAvailableLocales, getAvailableULocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getInstance, getInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, hashCode, isLenient, parse, parse, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone

Methods inherited from class com.ibm.icu.text.UFormat

getLocale

Constructor Details

ChineseDateFormat

public ChineseDateFormat(String pattern,
                         Locale locale)
Construct a ChineseDateFormat from a date format pattern and locale
Parameters:
pattern - the pattern
locale - the locale

ChineseDateFormat

public ChineseDateFormat(String pattern,
                         ULocale locale)
Construct a ChineseDateFormat from a date format pattern and locale
Parameters:
pattern - the pattern
locale - the locale

Method Details

subFormat

protected void subFormat(StringBuffer buf,
                         char ch,
                         int count,
                         int beginOffset,
                         FieldPosition pos,
                         Calendar cal)
Overrides:
subFormat in interface SimpleDateFormat

subParse

protected int subParse(String text,
                       int start,
                       char ch,
                       int count,
                       boolean obeyCount,
                       boolean allowNegative,
                       boolean[] ambiguousYear,
                       Calendar cal)
Overrides:
subParse in interface SimpleDateFormat

Copyright (c) 2006 IBM Corporation and others.