Class DateFormat.Field
java.lang.Object
java.text.AttributedCharacterIterator.Attribute
java.text.Format.Field
com.ibm.icu.text.DateFormat.Field
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ChineseDateFormat.Field
- Enclosing class:
DateFormat
The instances of this inner class are used as attribute keys and values in
AttributedCharacterIterator that DateFormat.formatToCharacterIterator() method returns.
There is no public constructor to this class, the only instances are the constants defined here.
- Author:
- Mark Davis, Chen-Lieh Huang, Alan Liu
- See Also:
- Status:
- Stable ICU 3.8.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DateFormat.FieldConstant identifying the time of day indicator(am/pm).static final DateFormat.Field[icu] Constant identifying the am/pm/midnight/noon field.static final DateFormat.FieldConstant identifying the day of month field.static final DateFormat.FieldConstant identifying the day of week field.static final DateFormat.FieldConstant identifying the day of week in month field.static final DateFormat.FieldConstant identifying the day of year field.static final DateFormat.FieldConstant identifying the local day of week field.static final DateFormat.FieldConstant identifying the era field.static final DateFormat.FieldConstant identifying the extended year field.static final DateFormat.Field[icu] Constant identifying the flexible day period field.static final DateFormat.FieldConstant identifying the hour(0-23) of day field.static final DateFormat.FieldConstant identifying the hour(1-24) of day field.static final DateFormat.FieldConstant identifying the hour(0-11) field.static final DateFormat.FieldConstant identifying the hour(1-12) field.static final DateFormat.FieldConstant identifying the Julian day field.static final DateFormat.FieldConstant identifying the millisecond field.static final DateFormat.FieldConstant identifying the milliseconds in day field.static final DateFormat.FieldConstant identifying the minute field.static final DateFormat.FieldConstant identifying the month field.static final DateFormat.FieldConstant identifying the quarter field.static final DateFormat.FieldDeprecated.This API is ICU internal only.static final DateFormat.FieldConstant identifying the second field.static final DateFormat.FieldDeprecated.This API is ICU internal only.static final DateFormat.FieldConstant identifying the time zone field.static final DateFormat.FieldConstant identifying the week of month field.static final DateFormat.FieldConstant identifying the week of year field.static final DateFormat.FieldConstant identifying the year field.static final DateFormat.FieldConstant identifying the year used with week of year field.Fields inherited from class AttributedCharacterIterator.Attribute
INPUT_METHOD_SEGMENT, LANGUAGE, READING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns theCalendarfield associated with this attribute.static DateFormat.FieldofCalendarField(int calendarField) Returns theFieldconstant that corresponds to theCalendarfieldcalendarField.protected ObjectResolves instances being deserialized to the predefined constants.Methods inherited from class AttributedCharacterIterator.Attribute
equals, getName, hashCode, toString
-
Field Details
-
AM_PM
Constant identifying the time of day indicator(am/pm).- Status:
- Stable ICU 3.8.
-
DAY_OF_MONTH
Constant identifying the day of month field.- Status:
- Stable ICU 3.8.
-
DAY_OF_WEEK
Constant identifying the day of week field.- Status:
- Stable ICU 3.8.
-
DAY_OF_WEEK_IN_MONTH
Constant identifying the day of week in month field.- Status:
- Stable ICU 3.8.
-
DAY_OF_YEAR
Constant identifying the day of year field.- Status:
- Stable ICU 3.8.
-
ERA
-
HOUR_OF_DAY0
Constant identifying the hour(0-23) of day field.- Status:
- Stable ICU 3.8.
-
HOUR_OF_DAY1
Constant identifying the hour(1-24) of day field.- Status:
- Stable ICU 3.8.
-
HOUR0
Constant identifying the hour(0-11) field.- Status:
- Stable ICU 3.8.
-
HOUR1
Constant identifying the hour(1-12) field.- Status:
- Stable ICU 3.8.
-
MILLISECOND
Constant identifying the millisecond field.- Status:
- Stable ICU 3.8.
-
MINUTE
Constant identifying the minute field.- Status:
- Stable ICU 3.8.
-
MONTH
Constant identifying the month field.- Status:
- Stable ICU 3.8.
-
SECOND
Constant identifying the second field.- Status:
- Stable ICU 3.8.
-
TIME_ZONE
Constant identifying the time zone field.- Status:
- Stable ICU 3.8.
-
WEEK_OF_MONTH
Constant identifying the week of month field.- Status:
- Stable ICU 3.8.
-
WEEK_OF_YEAR
Constant identifying the week of year field.- Status:
- Stable ICU 3.8.
-
YEAR
Constant identifying the year field.- Status:
- Stable ICU 3.8.
-
DOW_LOCAL
Constant identifying the local day of week field.- Status:
- Stable ICU 3.8.
-
EXTENDED_YEAR
Constant identifying the extended year field.- Status:
- Stable ICU 3.8.
-
JULIAN_DAY
Constant identifying the Julian day field.- Status:
- Stable ICU 3.8.
-
MILLISECONDS_IN_DAY
Constant identifying the milliseconds in day field.- Status:
- Stable ICU 3.8.
-
YEAR_WOY
Constant identifying the year used with week of year field.- Status:
- Stable ICU 3.8.
-
QUARTER
Constant identifying the quarter field.- Status:
- Stable ICU 3.8.
-
RELATED_YEAR
Deprecated.This API is ICU internal only.Constant identifying the related year field.- Status:
- Internal. This API is ICU internal only.
-
AM_PM_MIDNIGHT_NOON
[icu] Constant identifying the am/pm/midnight/noon field.- Status:
- Stable ICU 57.
-
FLEXIBLE_DAY_PERIOD
[icu] Constant identifying the flexible day period field.- Status:
- Stable ICU 57.
-
TIME_SEPARATOR
Deprecated.This API is ICU internal only.Constant identifying the time separator field.- Status:
- Internal. This API is ICU internal only.
-
-
Constructor Details
-
Field
Constructs aDateFormat.Fieldwith the given name and theCalendarfield which this attribute represents. Use -1 forcalendarFieldif this field does not have a correspondingCalendarfield.- Parameters:
name- Name of the attributecalendarField-Calendarfield constant- Status:
- Stable ICU 3.8.
-
-
Method Details
-
ofCalendarField
Returns theFieldconstant that corresponds to theCalendarfieldcalendarField. If there is no correspondingFieldis available, null is returned.- Parameters:
calendarField-Calendarfield constant- Returns:
Fieldassociated with thecalendarField, or null if no associatedFieldis available.- Throws:
IllegalArgumentException- ifcalendarFieldis not a validCalendarfield constant.- Status:
- Stable ICU 3.8.
-
getCalendarField
public int getCalendarField()Returns theCalendarfield associated with this attribute. If there is no correspondingCalendaravailable, this will return -1.- Returns:
Calendarconstant for this attribute.- Status:
- Stable ICU 3.8.
-
readResolve
Resolves instances being deserialized to the predefined constants.- Overrides:
readResolvein classAttributedCharacterIterator.Attribute- Throws:
InvalidObjectException- if the constant could not be resolved.- Status:
- Stable ICU 3.8.
-