DateFormat.Field

public static class DateFormat.Field
extends Format.Field

java.lang.Object
   ↳ java.text.AttributedCharacterIterator.Attribute
     ↳ java.text.Format.Field
       ↳ android.icu.text.DateFormat.Field


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.

Summary

Fields

public static final DateFormat.Field AM_PM

Constant identifying the time of day indicator(am/pm).

public static final DateFormat.Field AM_PM_MIDNIGHT_NOON

[icu] Constant identifying the am/pm/midnight/noon field.

public static final DateFormat.Field DAY_OF_MONTH

Constant identifying the day of month field.

public static final DateFormat.Field DAY_OF_WEEK

Constant identifying the day of week field.

public static final DateFormat.Field DAY_OF_WEEK_IN_MONTH

Constant identifying the day of week in month field.

public static final DateFormat.Field DAY_OF_YEAR

Constant identifying the day of year field.

public static final DateFormat.Field DOW_LOCAL

Constant identifying the local day of week field.

public static final DateFormat.Field ERA

Constant identifying the era field.

public static final DateFormat.Field EXTENDED_YEAR

Constant identifying the extended year field.

public static final DateFormat.Field FLEXIBLE_DAY_PERIOD

[icu] Constant identifying the flexible day period field.

public static final DateFormat.Field HOUR0

Constant identifying the hour(0-11) field.

public static final DateFormat.Field HOUR1

Constant identifying the hour(1-12) field.

public static final DateFormat.Field HOUR_OF_DAY0

Constant identifying the hour(0-23) of day field.

public static final DateFormat.Field HOUR_OF_DAY1

Constant identifying the hour(1-24) of day field.

public static final DateFormat.Field JULIAN_DAY

Constant identifying the Julian day field.

public static final DateFormat.Field MILLISECOND

Constant identifying the millisecond field.

public static final DateFormat.Field MILLISECONDS_IN_DAY

Constant identifying the milliseconds in day field.

public static final DateFormat.Field MINUTE

Constant identifying the minute field.

public static final DateFormat.Field MONTH

Constant identifying the month field.

public static final DateFormat.Field QUARTER

Constant identifying the quarter field.

public static final DateFormat.Field SECOND

Constant identifying the second field.

public static final DateFormat.Field TIME_ZONE

Constant identifying the time zone field.

public static final DateFormat.Field WEEK_OF_MONTH

Constant identifying the week of month field.

public static final DateFormat.Field WEEK_OF_YEAR

Constant identifying the week of year field.

public static final DateFormat.Field YEAR

Constant identifying the year field.

public static final DateFormat.Field YEAR_WOY

Constant identifying the year used with week of year field.

Inherited fields

Protected constructors

Field(String name, int calendarField)

Constructs a DateFormat.Field with the given name and the Calendar field which this attribute represents.

Public methods

int getCalendarField()

Returns the Calendar field associated with this attribute.

static DateFormat.Field ofCalendarField(int calendarField)

Returns the Field constant that corresponds to the Calendar field calendarField.

Protected methods

Object readResolve()

Resolves instances being deserialized to the predefined constants.

Inherited methods

Fields

AM_PM

Added in API level 24
public static final DateFormat.Field AM_PM

Constant identifying the time of day indicator(am/pm).

AM_PM_MIDNIGHT_NOON

Added in API level 28
public static final DateFormat.Field AM_PM_MIDNIGHT_NOON

[icu] Constant identifying the am/pm/midnight/noon field.

DAY_OF_MONTH

Added in API level 24
public static final DateFormat.Field DAY_OF_MONTH

Constant identifying the day of month field.

DAY_OF_WEEK

Added in API level 24
public static final DateFormat.Field DAY_OF_WEEK

Constant identifying the day of week field.

DAY_OF_WEEK_IN_MONTH

Added in API level 24
public static final DateFormat.Field DAY_OF_WEEK_IN_MONTH

Constant identifying the day of week in month field.

DAY_OF_YEAR

Added in API level 24
public static final DateFormat.Field DAY_OF_YEAR

Constant identifying the day of year field.

DOW_LOCAL

Added in API level 24
public static final DateFormat.Field DOW_LOCAL

Constant identifying the local day of week field.

ERA

Added in API level 24
public static final DateFormat.Field ERA

Constant identifying the era field.

EXTENDED_YEAR

Added in API level 24
public static final DateFormat.Field EXTENDED_YEAR

Constant identifying the extended year field.

FLEXIBLE_DAY_PERIOD

Added in API level 28
public static final DateFormat.Field FLEXIBLE_DAY_PERIOD

[icu] Constant identifying the flexible day period field.

HOUR0

Added in API level 24
public static final DateFormat.Field HOUR0

Constant identifying the hour(0-11) field.

HOUR1

Added in API level 24
public static final DateFormat.Field HOUR1

Constant identifying the hour(1-12) field.

HOUR_OF_DAY0

Added in API level 24
public static final DateFormat.Field HOUR_OF_DAY0

Constant identifying the hour(0-23) of day field.

HOUR_OF_DAY1

Added in API level 24
public static final DateFormat.Field HOUR_OF_DAY1

Constant identifying the hour(1-24) of day field.

JULIAN_DAY

Added in API level 24
public static final DateFormat.Field JULIAN_DAY

Constant identifying the Julian day field.

MILLISECOND

Added in API level 24
public static final DateFormat.Field MILLISECOND

Constant identifying the millisecond field.

MILLISECONDS_IN_DAY

Added in API level 24
public static final DateFormat.Field MILLISECONDS_IN_DAY

Constant identifying the milliseconds in day field.

MINUTE

Added in API level 24
public static final DateFormat.Field MINUTE

Constant identifying the minute field.

MONTH

Added in API level 24
public static final DateFormat.Field MONTH

Constant identifying the month field.

QUARTER

Added in API level 24
public static final DateFormat.Field QUARTER

Constant identifying the quarter field.

SECOND

Added in API level 24
public static final DateFormat.Field SECOND

Constant identifying the second field.

TIME_ZONE

Added in API level 24
public static final DateFormat.Field TIME_ZONE

Constant identifying the time zone field.

WEEK_OF_MONTH

Added in API level 24
public static final DateFormat.Field WEEK_OF_MONTH

Constant identifying the week of month field.

WEEK_OF_YEAR

Added in API level 24
public static final DateFormat.Field WEEK_OF_YEAR

Constant identifying the week of year field.

YEAR

Added in API level 24
public static final DateFormat.Field YEAR

Constant identifying the year field.

YEAR_WOY

Added in API level 24
public static final DateFormat.Field YEAR_WOY

Constant identifying the year used with week of year field.

Protected constructors

Field

Added in API level 24
protected Field (String name, 
                int calendarField)

Constructs a DateFormat.Field with the given name and the Calendar field which this attribute represents. Use -1 for calendarField if this field does not have a corresponding Calendar field.

Parameters
name String: Name of the attribute

calendarField int: Calendar field constant

Public methods

getCalendarField

Added in API level 24
public int getCalendarField ()

Returns the Calendar field associated with this attribute. If there is no corresponding Calendar available, this will return -1.

Returns
int Calendar constant for this attribute.

ofCalendarField

Added in API level 24
public static DateFormat.Field ofCalendarField (int calendarField)

Returns the Field constant that corresponds to the Calendar field calendarField. If there is no corresponding Field is available, null is returned.

Parameters
calendarField int: Calendar field constant

Returns
DateFormat.Field Field associated with the calendarField, or null if no associated Field is available.

Throws
IllegalArgumentException if calendarField is not a valid Calendar field constant.

Protected methods

readResolve

Added in API level 24
protected Object readResolve ()

Resolves instances being deserialized to the predefined constants.

Returns
Object the resolved Attribute object

Throws
InvalidObjectException if the constant could not be resolved.