加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090225064616/http://developer.android.com:80/reference/java/text/DateFormat.Field.html
public static class

DateFormat.Field

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

Class Overview

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

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

Summary

Constants
DateFormat.Field AM_PM Marks the time indicator part of a date.
DateFormat.Field DAY_OF_MONTH Marks the day of the month part of a date.
DateFormat.Field DAY_OF_WEEK Marks the day of the week part of a date.
DateFormat.Field DAY_OF_WEEK_IN_MONTH Marks the day of the week in the month part of a date.
DateFormat.Field DAY_OF_YEAR Marks the day of the year part of a date.
DateFormat.Field ERA Marks the era part of a date.
DateFormat.Field HOUR0 Marks the hour part of a date (0-11).
DateFormat.Field HOUR1 Marks the hour part of a date (1-12).
DateFormat.Field HOUR_OF_DAY0 Marks the hour of the day part of a date (0-11).
DateFormat.Field HOUR_OF_DAY1 Marks the hour of the day part of a date (1-12).
DateFormat.Field MILLISECOND Marks the millisecond part of a time.
DateFormat.Field MINUTE Marks the minute part of a time.
DateFormat.Field MONTH Marks the month part of a date.
DateFormat.Field SECOND Marks the second part of a time.
DateFormat.Field TIME_ZONE Marks the time zone part of a date.
DateFormat.Field WEEK_OF_MONTH Marks the week of the month part of a date.
DateFormat.Field WEEK_OF_YEAR Marks the week of the year part of a date.
DateFormat.Field YEAR Marks the year part of a date.
[Expand]
Inherited Constants
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 this Field represents
static DateFormat.Field ofCalendarField(int calendarField)
Returns the DateFormat.Field instance for the given calendar field
Protected Methods
Object readResolve()
Serialization method resolve instances to the constant DateFormat.Field values
[Expand]
Inherited Methods
From class java.text.AttributedCharacterIterator.Attribute
From class java.lang.Object

Constants

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.

Protected Constructors

protected DateFormat.Field (String fieldName, int calendarField)

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

Parameters
fieldName The field name.
calendarField the calender field type of the field.

Public Methods

public int getCalendarField ()

Returns the Calendar field this Field represents

Returns
  • int calendar field

public static DateFormat.Field ofCalendarField (int calendarField)

Returns the DateFormat.Field instance for the given calendar field

Parameters
calendarField a calendar field constant
Returns
  • null if there is no Field for this calendar field

Protected Methods

protected Object readResolve ()

Serialization method resolve instances to the constant DateFormat.Field values