Skip to content

Most visited

Recently visited

navigation
Added in API level 1

DateFormat.Field

public static class DateFormat.Field
extends Format.Field

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


The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that the formatToCharacterIterator(Object) method returns.

There is no public constructor in this class, the only instances are the constants defined here.

Summary

Fields

public static final DateFormat.Field AM_PM

Marks the time indicator part of a date.

public static final DateFormat.Field DAY_OF_MONTH

Marks the day of the month part of a date.

public static final DateFormat.Field DAY_OF_WEEK

Marks the day of the week part of a date.

public static final DateFormat.Field DAY_OF_WEEK_IN_MONTH

Marks the day of the week in the month part of a date.

public static final DateFormat.Field DAY_OF_YEAR

Marks the day of the year part of a date.

public static final DateFormat.Field ERA

Marks the era part of a date.

public static final DateFormat.Field HOUR0

Marks the hour part of a date (0-11).

public static final DateFormat.Field HOUR1

Marks the hour part of a date (1-12).

public static final DateFormat.Field HOUR_OF_DAY0

Marks the hour of the day part of a date (0-11).

public static final DateFormat.Field HOUR_OF_DAY1

Marks the hour of the day part of a date (1-12).

public static final DateFormat.Field MILLISECOND

Marks the millisecond part of a time.

public static final DateFormat.Field MINUTE

Marks the minute part of a time.

public static final DateFormat.Field MONTH

Marks the month part of a date.

public static final DateFormat.Field SECOND

Marks the second part of a time.

public static final DateFormat.Field TIME_ZONE

Marks the time zone part of a date.

public static final DateFormat.Field WEEK_OF_MONTH

Marks the week of the month part of a date.

public static final DateFormat.Field WEEK_OF_YEAR

Marks the week of the year part of a date.

public static final DateFormat.Field YEAR

Marks the year part of a date.

Inherited fields

From class java.text.AttributedCharacterIterator.Attribute

Protected constructors

DateFormat.Field(String fieldName, int calendarField)

Constructs a new instance of DateFormat.Field with the given fieldName and calendar field.

Public methods

int getCalendarField()

Returns the Calendar field that this field represents.

static DateFormat.Field ofCalendarField(int calendarField)

Returns the DateFormat.Field instance for the given calendar field.

Inherited methods

From class java.text.AttributedCharacterIterator.Attribute
From class java.lang.Object

Fields

AM_PM

Added in API level 1
DateFormat.Field AM_PM

Marks the time indicator part of a date.

DAY_OF_MONTH

Added in API level 1
DateFormat.Field DAY_OF_MONTH

Marks the day of the month part of a date.

DAY_OF_WEEK

Added in API level 1
DateFormat.Field DAY_OF_WEEK

Marks the day of the week part of a date.

DAY_OF_WEEK_IN_MONTH

Added in API level 1
DateFormat.Field DAY_OF_WEEK_IN_MONTH

Marks the day of the week in the month part of a date.

DAY_OF_YEAR

Added in API level 1
DateFormat.Field DAY_OF_YEAR

Marks the day of the year part of a date.

ERA

Added in API level 1
DateFormat.Field ERA

Marks the era part of a date.

HOUR0

Added in API level 1
DateFormat.Field HOUR0

Marks the hour part of a date (0-11).

HOUR1

Added in API level 1
DateFormat.Field HOUR1

Marks the hour part of a date (1-12).

HOUR_OF_DAY0

Added in API level 1
DateFormat.Field HOUR_OF_DAY0

Marks the hour of the day part of a date (0-11).

HOUR_OF_DAY1

Added in API level 1
DateFormat.Field HOUR_OF_DAY1

Marks the hour of the day part of a date (1-12).

MILLISECOND

Added in API level 1
DateFormat.Field MILLISECOND

Marks the millisecond part of a time.

MINUTE

Added in API level 1
DateFormat.Field MINUTE

Marks the minute part of a time.

MONTH

Added in API level 1
DateFormat.Field MONTH

Marks the month part of a date.

SECOND

Added in API level 1
DateFormat.Field SECOND

Marks the second part of a time.

TIME_ZONE

Added in API level 1
DateFormat.Field TIME_ZONE

Marks the time zone part of a date.

WEEK_OF_MONTH

Added in API level 1
DateFormat.Field WEEK_OF_MONTH

Marks the week of the month part of a date.

WEEK_OF_YEAR

Added in API level 1
DateFormat.Field WEEK_OF_YEAR

Marks the week of the year part of a date.

YEAR

Added in API level 1
DateFormat.Field YEAR

Marks the year part of a date.

Protected constructors

DateFormat.Field

Added in API level 1
DateFormat.Field (String fieldName, 
                int calendarField)

Constructs a new instance of DateFormat.Field with the given fieldName and calendar field.

Parameters
fieldName String: the field name.
calendarField int: the calendar field type of the field.

Public methods

getCalendarField

Added in API level 1
int getCalendarField ()

Returns the Calendar field that this field represents.

Returns
int the calendar field.

ofCalendarField

Added in API level 1
DateFormat.Field ofCalendarField (int calendarField)

Returns the DateFormat.Field instance for the given calendar field.

Parameters
calendarField int: a calendar field constant.
Returns
DateFormat.Field the DateFormat.Field corresponding to calendarField.
Throws
IllegalArgumentException if calendarField is negative or greater than the field count of Calendar.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.