Calendar
field values.
Calendar types are used to specify calendar systems for which the getDisplayName
and getDisplayNames
methods provide
calendar field value names. See Calendar#getCalendarType()
for details.
Calendar Fields
Calendar fields are specified with the constants defined in Calendar
. The following are calendar-common fields and their values to be
supported for each calendar system.
Field | Value | Description |
---|---|---|
Calendar#MONTH |
Calendar#JANUARY to Calendar#UNDECIMBER |
Month numbering is 0-based (e.g., 0 - January, ..., 11 - December). Some calendar systems have 13 months. Month names need to be supported in both the formatting and stand-alone forms if required by the supported locales. If there's no distinction in the two forms, the same names should be returned in both of the forms. |
Calendar#DAY_OF_WEEK |
Calendar#SUNDAY to Calendar#SATURDAY |
Day-of-week numbering is 1-based starting from Sunday (i.e., 1 - Sunday, ..., 7 - Saturday). |
Calendar#AM_PM |
Calendar#AM to Calendar#PM |
0 - AM, 1 - PM |
The following are calendar-specific fields and their values to be supported.
Calendar Type | Field | Value | Description |
---|---|---|---|
"gregory" |
Calendar#ERA |
0 | java. (BCE) |
1 | java. (CE) |
||
"buddhist" |
Calendar#ERA |
0 | BC (BCE) |
1 | B.E. (Buddhist Era) | ||
"japanese" |
Calendar#ERA |
0 | Seireki (Before Meiji) |
1 | Meiji | ||
2 | Taisho | ||
3 | Showa | ||
4 | Heisei | ||
5 | Reiwa | ||
Calendar#YEAR |
1 | the first year in each era. It should be returned when a long
style (Calendar#LONG_FORMAT or Calendar#LONG_STANDALONE ) is
specified. See also the
Year representation in SimpleDateFormat . |
|
"roc" |
Calendar#ERA |
0 | Before R.O.C. |
1 | R.O.C. | ||
"islamic" |
Calendar#ERA |
0 | Before AH |
1 | Anno Hijrah (AH) |
Calendar field value names for "gregory"
must be consistent with
the date-time symbols provided by java.
.
Time zone names are supported by TimeZoneNameProvider
.
CalendarDataProvider
, Locale#getUnicodeLocaleType(String)
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public abstract String | Returns: the string representation of thefield value , or null if the string representation is not applicable or
the given calendar type is unknownthe calendar type. (Any calendar type given by calendarType, int locale
is ignored.)the field, int Calendar field index,
such as Calendar#DAY_OF_WEEK the value of the value, int Calendar field ,
such as Calendar#MONDAY the string representation style: one of style, Locale Calendar#SHORT_FORMAT (SHORT ),
Calendar#SHORT_STANDALONE , Calendar#LONG_FORMAT (LONG ),
Calendar#LONG_STANDALONE ,
Calendar#NARROW_FORMAT ,
or Calendar#NARROW_STANDALONE the desired locale locale)Returns the string representation (display name) of the calendar
|
public abstract Map | Returns: aMap containing all display names of field in
style and locale and their field values,
or null if no display names are defined for field the calendar type. (Any calendar type given by calendarType, int locale
is ignored.)the calendar field for which the display names are returned field, int the style applied to the display names; one of
style, Locale Calendar#ALL_STYLES , Calendar#SHORT_FORMAT
(SHORT ), Calendar#SHORT_STANDALONE , Calendar#LONG_FORMAT
(LONG ), Calendar#LONG_STANDALONE ,
Calendar#NARROW_FORMAT ,
or Calendar#NARROW_STANDALONE the desired locale locale)Returns a |
CalendarNameProvider | back to summary |
---|---|
protected CalendarNameProvider() Sole constructor. (For invocation by subclass constructors, typically implicit.) |
getDisplayName | back to summary |
---|---|
public abstract String getDisplayName(String calendarType, int field, int value, int style, Locale locale) Returns the string representation (display name) of the calendar
For example, the following call will return getDisplayName("gregory", Calendar.DAY_OF_WEEK, Calendar.SUNDAY, Calendar.LONG_STANDALONE, Locale.ENGLISH);
|
getDisplayNames | back to summary |
---|---|
public abstract Map Returns a
For example, the following call will return a getDisplayNames("gregory", Calendar.MONTH, Calendar.ALL_STYLES, Locale.ENGLISH);
|