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 DateFormat
DateFormat.BooleanAttribute, DateFormat.HourCycleModifier and TypeClassDescriptionstatic enumboolean attributesstatic enumHour CycleNested classes/interfaces inherited from class UFormat
UFormat.SpanFieldModifier and TypeClassDescriptionstatic classA field that represents a span of text that may be composed with other fields. -
Field Summary
Fields inherited from class 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_SKELETONSModifier and TypeFieldDescriptionstatic final String[icu] Constant for generic non-location format, abbreviated if possible, such as PT; used in combinations date + time + zone, or time + zone.static final String[icu] Constant for date skeleton with abbreviated month.static final String[icu] Constant for date skeleton with abbreviated month and day.static final String[icu] Constant for date skeleton with abbreviated month, weekday, and day.static final String[icu] Constant for date skeleton with abbreviated quarter.static final String[icu] Constant for specific non-location format, abbreviated if possible, such as PDT; used in combinations date + time + zone, or time + zone.static final StringDeprecated.ICU 50 UseDateFormat.ABBR_MONTHinstead.static final String[icu] Constant for localized GMT/UTC format, such as GMT+8:00 or HPG-8:00; used in combinations date + time + zone, or time + zone.static final String[icu] Constant for date skeleton with abbreviated weekday.static final intFieldPosition selector for 'a' field alignment, corresponding to theCalendar.AM_PMfield.static final int[icu] FieldPosition selector for 'b' field alignment.protected CalendarThe calendar thatDateFormatuses to produce the time field values needed to implement date and time formatting.static final intFieldPosition selector for 'd' field alignment, corresponding to theCalendar.DATEfield.Deprecated.This API is ICU internal only.static final String[icu] Constant for date skeleton with day.static final intFieldPosition selector for 'E' field alignment, corresponding to theCalendar.DAY_OF_WEEKfield.static final intFieldPosition selector for 'F' field alignment, corresponding to theCalendar.DAY_OF_WEEK_IN_MONTHfield.static final intFieldPosition selector for 'D' field alignment, corresponding to theCalendar.DAY_OF_YEARfield.static final intConstant for default style pattern.static final int[icu] FieldPosition selector for 'e' field alignment, corresponding to theCalendar.DOW_LOCALfield.static final intFieldPosition selector for 'G' field alignment, corresponding to theCalendar.ERAfield.static final int[icu] FieldPosition selector for 'u' field alignment, corresponding to theCalendar.EXTENDED_YEARfield.static final intDeprecated.ICU 58 The numeric value may change over time, see ICU ticket #12420.static final int[icu] FieldPosition selector for 'B' field alignment.static final int[icu] FieldPosition selector for 'S' field alignment, corresponding to theCalendar.MILLISECONDfield.static final intConstant for full style pattern.static final String[icu] Constant for generic non-location format, such as Pacific Time; used in combinations date + time + zone, or time + zone.static final String[icu] Constant for date skeleton with hour, with the locale's preferred hour format (12 or 24).static final StringDeprecated.ICU 50 Use insteadDateFormat.HOUR+DateFormat.ABBR_GENERIC_TZor some other timezone presentation.static final String[icu] Constant for date skeleton with hour and minute, with the locale's preferred hour format (12 or 24).static final StringDeprecated.ICU 50 Use insteadDateFormat.HOUR_MINUTE+DateFormat.ABBR_GENERIC_TZor some other timezone presentation.static final String[icu] Constant for date skeleton with hour, minute, and second, with the locale's preferred hour format (12 or 24).static final StringDeprecated.ICU 50 Use insteadDateFormat.HOUR_MINUTE+DateFormat.ABBR_SPECIFIC_TZor some other timezone presentation.static final intFieldPosition selector for 'H' field alignment, corresponding to theCalendar.HOUR_OF_DAYfield.static final intFieldPosition selector for 'k' field alignment, corresponding to theCalendar.HOUR_OF_DAYfield.static final StringDeprecated.ICU 50 Use insteadDateFormat.HOUR+DateFormat.ABBR_SPECIFIC_TZor some other timezone presentation.static final intFieldPosition selector for 'K' field alignment, corresponding to theCalendar.HOURfield.static final intFieldPosition selector for 'h' field alignment, corresponding to theCalendar.HOURfield.static final String[icu] Constant for date skeleton with hour in 24-hour presentation.static final String[icu] Constant for date skeleton with hour and minute in 24-hour presentation.static final String[icu] Constant for date skeleton with hour, minute, and second in 24-hour presentation.static final StringDeprecated.This API is ICU internal only.static final StringDeprecated.This API is ICU internal only.static final StringDeprecated.This API is ICU internal only.static final int[icu] FieldPosition selector for 'g' field alignment, corresponding to theCalendar.JULIAN_DAYfield.static final String[icu] Constant for generic location format, such as Los Angeles Time; used in combinations date + time + zone, or time + zone.static final intConstant for long style pattern.static final intConstant for medium style pattern.static final intAlias for FRACTIONAL_SECOND_FIELD.static final int[icu] FieldPosition selector for 'A' field alignment, corresponding to theCalendar.MILLISECONDS_IN_DAYfield.static final String[icu] Constant for date skeleton with minute.static final intFieldPosition selector for 'm' field alignment, corresponding to theCalendar.MINUTEfield.static final String[icu] Constant for date skeleton with minute and second.static final String[icu] Constant for date skeleton with month.static final String[icu] Constant for date skeleton with long month and day.static final intFieldPosition selector for 'M' field alignment, corresponding to theCalendar.MONTHfield.static final String[icu] Constant for date skeleton with month, weekday, and day.static final int[icu] Constant for empty style pattern.static final String[icu] Constant for date skeleton with numeric month.static final String[icu] Constant for date skeleton with numeric month and day.static final String[icu] Constant for date skeleton with numeric month, weekday, and day.protected NumberFormatThe number formatter thatDateFormatuses to format numbers in dates and times.static final String[icu] Constant for date skeleton with quarter.static final int[icu] FieldPosition selector for 'Q' field alignment, corresponding to theCalendar.MONTHfield.static final int[icu] Constant for relative style mask.static final int[icu] Constant for relative default style pattern.static final int[icu] Constant for relative full style pattern.static final int[icu] Constant for relative style pattern.static final int[icu] Constant for relative style pattern.static final int[icu] Constant for relative style pattern.static final String[icu] Constant for date skeleton with second.static final intFieldPosition selector for 's' field alignment, corresponding to theCalendar.SECONDfield.static final intConstant for short style pattern.static final String[icu] Constant for specific non-location format, such as Pacific Daylight Time; used in combinations date + time + zone, or time + zone.static final int[icu] FieldPosition selector for 'c' field alignment, corresponding to theCalendar.DAY_OF_WEEKfield.static final StringDeprecated.ICU 50 UseDateFormat.MONTHinstead.static final int[icu] FieldPosition selector for 'L' field alignment, corresponding to theCalendar.MONTHfield.static final int[icu] FieldPosition selector for 'q' field alignment, corresponding to theCalendar.MONTHfield.static final intDeprecated.This API is ICU internal only.Deprecated.This API is ICU internal only.static final intFieldPosition selector for 'z' field alignment, corresponding to theCalendar.ZONE_OFFSETandCalendar.DST_OFFSETfields.static final int[icu] FieldPosition selector for 'v' field alignment, corresponding to theCalendar.ZONE_OFFSETandCalendar.DST_OFFSETfields.static final int[icu] FieldPosition selector for 'X' field alignment, corresponding to theCalendar.ZONE_OFFSETandCalendar.DST_OFFSETfields.static final int[icu] FieldPosition selector for 'x' field alignment, corresponding to theCalendar.ZONE_OFFSETandCalendar.DST_OFFSETfields.static final int[icu] FieldPosition selector for 'O' field alignment, corresponding to theCalendar.ZONE_OFFSETandCalendar.DST_OFFSETfields.static final int[icu] FieldPosition selector for 'Z' field alignment, corresponding to theCalendar.ZONE_OFFSETandCalendar.DST_OFFSETfields.static final int[icu] FieldPosition selector for 'V' field alignment, corresponding to theCalendar.ZONE_OFFSETandCalendar.DST_OFFSETfields.static final intFieldPosition selector for 'W' field alignment, corresponding to theCalendar.WEEK_OF_MONTHfield.static final intFieldPosition selector for 'w' field alignment, corresponding to theCalendar.WEEK_OF_YEARfield.static final String[icu] Constant for date skeleton with weekday.static final String[icu] Constant for date skeleton with year.static final String[icu] Constant for date skeleton with year and abbreviated month.static final String[icu] Constant for date skeleton with year, abbreviated month, and day.static final String[icu] Constant for date skeleton with year, abbreviated month, weekday, and day.static final String[icu] Constant for date skeleton with year and abbreviated quarter.static final intFieldPosition selector for 'y' field alignment, corresponding to theCalendar.YEARfield.static final String[icu] Constant for date skeleton with year and month.static final String[icu] Constant for date skeleton with year, month, and day.static final String[icu] Constant for date skeleton with year, month, weekday, and day.static final int[icu] FieldPosition selector for 'U' field alignment, corresponding to theCalendar.YEARfield.static final String[icu] Constant for date skeleton with year and numeric month.static final String[icu] Constant for date skeleton with year, numeric month, and day.static final String[icu] Constant for date skeleton with year, numeric month, weekday, and day.static final String[icu] Constant for date skeleton with year and quarter.static final int[icu] FieldPosition selector for 'Y' field alignment, corresponding to theCalendar.YEAR_WOYfield.Deprecated.This API is ICU internal only. -
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.FieldpatternCharToDateFormatField(char ch) Deprecated.ICU 50protected voidsubFormat(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 intsubParse(String text, int start, char ch, int count, boolean obeyCount, boolean allowNegative, boolean[] ambiguousYear, Calendar cal) Deprecated.ICU 50Methods inherited from class 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, zeroPaddingNumberModifier and TypeMethodDescriptionvoidApply the given localized pattern string to this date format.voidapplyPattern(String pat) Apply the given unlocalized pattern string to this date format.clone()Overrides CloneablebooleanOverride equals.format(Calendar cal, StringBuffer toAppendTo, FieldPosition pos) Formats a date or time, which is the standard millis since January 1, 1970, 00:00:00 GMT.Format the object to an attributed string, and return the corresponding iterator Overrides superclass method.Returns the beginning date of the 100-year period 2-digit years are interpreted as being within.Gets the date/time formatting data.static SimpleDateFormatgetInstance(Calendar.FormatConfiguration formatConfig) Deprecated.This API is ICU internal only.getNumberFormat(char field) give the NumberFormat used for the field like 'y'(year) and 'M'(year)protected DateFormatSymbolsMethod for subclasses to access the DateFormatSymbols.[icu] Gets the time zone formatter which this date/time formatter uses to format and parse a time zone.inthashCode()Override hashCode.final StringBufferintervalFormatByAlgorithm(Calendar fromCalendar, Calendar toCalendar, StringBuffer appendTo, FieldPosition pos) Deprecated.This API is ICU internal only.protected intmatchQuarterString(String text, int start, int field, String[] data, Calendar cal) Attempt to match the text at a given position against an array of quarter strings.protected intmatchString(String text, int start, int field, String[] data, Calendar cal) Attempt to match the text at a given position against an array of strings.voidparse(String text, Calendar cal, ParsePosition parsePos) Overrides DateFormatvoidset2DigitYearStart(Date startDate) Sets the 100-year period 2-digit years will be interpreted as being in to begin on the date the user specifies.voidsetContext(DisplayContext context) [icu] Set a particular DisplayContext value in the formatter, such as CAPITALIZATION_FOR_STANDALONE.voidsetDateFormatSymbols(DateFormatSymbols newFormatSymbols) Allows you to set the date/time formatting data.voidsetNumberFormat(NumberFormat newNumberFormat) Overrides superclass method and This method also clears per field NumberFormat instances previously set bySimpleDateFormat.setNumberFormat(String, NumberFormat)voidsetNumberFormat(String fields, NumberFormat overrideNF) allow the user to set the NumberFormat for several fields It can be a single field like: "y"(year) or "M"(month) It can be several field combined together: "yMd"(year, month and date) Note: 1 symbol field is enough for multiple symbol fields (so "y" will override "yy", "yyy") If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field)voidsetTimeZoneFormat(TimeZoneFormat tzfmt) [icu] Allows you to set the time zone formatter.protected StringsubFormat(char ch, int count, int beginOffset, int fieldNum, DisplayContext capitalizationContext, FieldPosition pos, char patternCharToOutput, Calendar cal) Deprecated.This API is ICU internal only.protected StringsubFormat(char ch, int count, int beginOffset, FieldPosition pos, DateFormatSymbols fmtData, Calendar cal) Formats a single field, given its pattern character.Return a localized pattern string describing this date format.Return a pattern string describing this date format.protected StringzeroPaddingNumber(long value, int minDigits, int maxDigits) Formats a number with the specified minimum and maximum number of digits.protected voidzeroPaddingNumber(NumberFormat nf, StringBuffer buf, int value, int minDigits, int maxDigits) Deprecated.This API is ICU internal only.Methods inherited from class DateFormat
format, format, 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, setTimeZoneModifier and TypeMethodDescriptionfinal StringBufferformat(Object obj, StringBuffer toAppendTo, FieldPosition fieldPosition) Formats a time object into a time string.final StringFormats aTemporalinto a date/time string.format(Temporal date, StringBuffer toAppendTo, FieldPosition fieldPosition) Formats aTemporalinto a date/time string.final StringFormats a Date into a date/time string.format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) Formats a Date into a date/time string.static Locale[]Returns the set of locales for which DateFormats are installed.static ULocale[][icu] Returns the set of locales for which DateFormats are installed.booleanReturns the current value for the specified BooleanAttribute for this instanceReturns the calendar associated with this date/time formatter.[icu] Get the formatter's DisplayContext value for the specified DisplayContext.Type, such as CAPITALIZATION.static final DateFormatReturns the date formatter with the default formatting style for the defaultFORMATlocale.static final DateFormatgetDateInstance(int style) Returns the date formatter with the given formatting style for the defaultFORMATlocale.static final DateFormatgetDateInstance(int style, ULocale locale) Returns the date formatter with the given formatting style for the given locale.static final DateFormatgetDateInstance(int style, Locale aLocale) Returns the date formatter with the given formatting style for the given locale.static final DateFormatgetDateInstance(Calendar cal, int dateStyle) Creates aDateFormatobject for the default locale that can be used to format dates in the calendar system specified bycal.static final DateFormatgetDateInstance(Calendar cal, int dateStyle, ULocale locale) Creates aDateFormatobject that can be used to format dates in the calendar system specified bycal.static final DateFormatgetDateInstance(Calendar cal, int dateStyle, Locale locale) Creates aDateFormatobject that can be used to format dates in the calendar system specified bycal.static final DateFormatReturns the date/time formatter with the default formatting style for the defaultFORMATlocale.static final DateFormatgetDateTimeInstance(int dateStyle, int timeStyle) Returns the date/time formatter with the given date and time formatting styles for the defaultFORMATlocale.static final DateFormatgetDateTimeInstance(int dateStyle, int timeStyle, ULocale locale) Returns the date/time formatter with the given formatting styles for the given locale.static final DateFormatgetDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) Returns the date/time formatter with the given formatting styles for the given locale.static final DateFormatgetDateTimeInstance(Calendar cal, int dateStyle, int timeStyle) Creates aDateFormatobject for the default locale that can be used to format dates and times in the calendar system specified bycal.static final DateFormatgetDateTimeInstance(Calendar cal, int dateStyle, int timeStyle, ULocale locale) Creates aDateFormatobject that can be used to format dates and times in the calendar system specified bycal.static final DateFormatgetDateTimeInstance(Calendar cal, int dateStyle, int timeStyle, Locale locale) Creates aDateFormatobject that can be used to format dates and times in the calendar system specified bycal.static final DateFormatReturns a default date/time formatter that uses the SHORT style for both the date and the time.static final DateFormatgetInstance(Calendar cal) Returns a default date/time formatter that uses the SHORT style for both the date and the time.static final DateFormatgetInstance(Calendar cal, ULocale locale) Returns a date/time formatter that uses the SHORT style for both the date and the time.static final DateFormatgetInstance(Calendar cal, Locale locale) Returns a date/time formatter that uses the SHORT style for both the date and the time.static final DateFormatgetInstanceForSkeleton(Calendar cal, String skeleton, ULocale locale) [icu] Creates aDateFormatobject that can be used to format dates and times in the calendar system specified bycal.static final DateFormatgetInstanceForSkeleton(Calendar cal, String skeleton, Locale locale) [icu] Creates aDateFormatobject that can be used to format dates and times in the calendar system specified bycal.static final DateFormatgetInstanceForSkeleton(String skeleton) [icu] Returns aDateFormatobject that can be used to format dates and times in the default locale.static final DateFormatgetInstanceForSkeleton(String skeleton, ULocale locale) [icu] Returns aDateFormatobject that can be used to format dates and times in the given locale.static final DateFormatgetInstanceForSkeleton(String skeleton, Locale locale) [icu] Returns aDateFormatobject that can be used to format dates and times in the given locale.Returns the number formatter which this date/time formatter uses to format and parse a time.static final DateFormatgetPatternInstance(Calendar cal, String skeleton, ULocale locale) [icu] Creates aDateFormatobject that can be used to format dates and times in the calendar system specified bycal.static final DateFormatgetPatternInstance(Calendar cal, String skeleton, Locale locale) [icu] Creates aDateFormatobject that can be used to format dates and times in the calendar system specified bycal.static final DateFormatgetPatternInstance(String skeleton) [icu] Returns aDateFormatobject that can be used to format dates and times in the default locale.static final DateFormatgetPatternInstance(String skeleton, ULocale locale) [icu] Returns aDateFormatobject that can be used to format dates and times in the given locale.static final DateFormatgetPatternInstance(String skeleton, Locale locale) [icu] Returns aDateFormatobject that can be used to format dates and times in the given locale.static final DateFormatGets the time formatter with the default formatting style for the defaultFORMATlocale.static final DateFormatgetTimeInstance(int style) Returns the time formatter with the given formatting style for the defaultFORMATlocale.static final DateFormatgetTimeInstance(int style, ULocale locale) Returns the time formatter with the given formatting style for the given locale.static final DateFormatgetTimeInstance(int style, Locale aLocale) Returns the time formatter with the given formatting style for the given locale.static final DateFormatgetTimeInstance(Calendar cal, int timeStyle) Creates aDateFormatobject that can be used to format times in the calendar system specified bycal.static final DateFormatgetTimeInstance(Calendar cal, int timeStyle, ULocale locale) Creates aDateFormatobject that can be used to format times in the calendar system specified bycal.static final DateFormatgetTimeInstance(Calendar cal, int timeStyle, Locale locale) Creates aDateFormatobject that can be used to format times in the calendar system specified bycal.Returns the time zone.booleanReturns whether date/time parsing in the encapsulated Calendar object is lenient.booleanReturns whether both date/time parsing in the encapsulated Calendar object and DateFormat whitespace & numeric processing is lenient.Parses a date/time string.parse(String text, ParsePosition pos) Parses a date/time string according to the given parse position.parseObject(String source, ParsePosition pos) Parses a date/time string into an Object.setBooleanAttribute(DateFormat.BooleanAttribute key, boolean value) Sets a boolean attribute for this instance.voidsetCalendar(Calendar newCalendar) Sets the calendar to be used by this date format.voidsetCalendarLenient(boolean lenient) Specifies whether date/time parsing in the encapsulated Calendar object should be lenient.voidsetLenient(boolean lenient) Specifies whether date/time parsing is to be lenient.voidsetTimeZone(TimeZone zone) Sets the time zone for the calendar of this DateFormat object.Methods inherited from class UFormat
getLocaleModifier and TypeMethodDescriptionfinal ULocalegetLocale(ULocale.Type type) Return the locale that was used to create this object, or null.Methods inherited from class 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:
subFormatin classSimpleDateFormat- Status:
- Internal. This API is ICU internal only.
-
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:
subParsein 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
calwith the parsed value.
-
patternCharToDateFormatField
Deprecated.ICU 50Returns a DateFormat.Field constant associated with the specified format pattern character.- Overrides:
patternCharToDateFormatFieldin classSimpleDateFormat- Parameters:
ch- The pattern character- Returns:
- DateFormat.Field associated with the pattern character
-