| java.lang.Object | ||
| ↳ | java.text.Format | |
| ↳ | java.text.DateFormat | |
Known Direct Subclasses
|
DateFormat is the abstract superclass of formats which format and parse Dates.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| DateFormat.Field | The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that SimpleDateFormat.formatToCharacterIterator() method returns. | ||||||||||
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | AM_PM_FIELD | Field constant. | |||||||||
| int | DATE_FIELD | Field constant. | |||||||||
| int | DAY_OF_WEEK_FIELD | Field constant. | |||||||||
| int | DAY_OF_WEEK_IN_MONTH_FIELD | Field constant. | |||||||||
| int | DAY_OF_YEAR_FIELD | Field constant. | |||||||||
| int | DEFAULT | Format style constant. | |||||||||
| int | ERA_FIELD | Field constant. | |||||||||
| int | FULL | Format style constant. | |||||||||
| int | HOUR0_FIELD | Field constant. | |||||||||
| int | HOUR1_FIELD | Field constant. | |||||||||
| int | HOUR_OF_DAY0_FIELD | Field constant. | |||||||||
| int | HOUR_OF_DAY1_FIELD | Field constant. | |||||||||
| int | LONG | Format style constant. | |||||||||
| int | MEDIUM | Format style constant. | |||||||||
| int | MILLISECOND_FIELD | Field constant. | |||||||||
| int | MINUTE_FIELD | Field constant. | |||||||||
| int | MONTH_FIELD | Field constant. | |||||||||
| int | SECOND_FIELD | Field constant. | |||||||||
| int | SHORT | Format style constant. | |||||||||
| int | TIMEZONE_FIELD | Field constant. | |||||||||
| int | WEEK_OF_MONTH_FIELD | Field constant. | |||||||||
| int | WEEK_OF_YEAR_FIELD | Field constant. | |||||||||
| int | YEAR_FIELD | Field constant. | |||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| calendar | The calendar that this DateFormat uses to format a number
representing a date. |
||||||||||
| numberFormat | The number format used to format a number. | ||||||||||
| Protected Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new instance of DateFormat.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns a new instance of DateFormat with the same properties.
| |||||||||||
Compares the specified object to this DateFormat and answer if they are
equal.
| |||||||||||
Formats the specified object into the specified StringBuffer using the
rules of this DateFormat.
| |||||||||||
Formats the specified Date using the rules of this DateFormat.
| |||||||||||
Formats the specified Date into the specified StringBuffer using the
rules of this DateFormat.
| |||||||||||
Gets the list of installed Locales which support DateFormat.
| |||||||||||
Returns the Calendar used by this DateFormat.
| |||||||||||
Returns a DateFormat instance for formatting and parsing dates in the
specified style for the specified Locale.
| |||||||||||
Returns a DateFormat instance for formatting and parsing dates in the
DEFAULT style for the default Locale.
| |||||||||||
Returns a DateFormat instance for formatting and parsing dates in the
specified style for the default Locale.
| |||||||||||
Returns a
DateFormat instance for the formatting and
parsing of both dates and times in the manner appropriate to the default
Locale. | |||||||||||
Returns a DateFormat instance for formatting and parsing dates and times
in the specified styles for the specified Locale.
| |||||||||||
Returns a DateFormat instance for formatting and parsing dates and times
in the DEFAULT style for the default Locale.
| |||||||||||
Returns a DateFormat instance for formatting and parsing dates and times
in the SHORT style for the default Locale.
| |||||||||||
Returns the NumberFormat used by this DateFormat.
| |||||||||||
Returns a DateFormat instance for formatting and parsing times in the
specified style for the default Locale.
| |||||||||||
Returns a DateFormat instance for formatting and parsing times in the
DEFAULT style for the default Locale.
| |||||||||||
Returns a DateFormat instance for formatting and parsing times in the
specified style for the specified Locale.
| |||||||||||
Returns the TimeZone of the Calendar used by this DateFormat.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Returns if the Calendar used by this DateFormat is lenient.
| |||||||||||
Parse a Date from the specified String using the rules of this
DateFormat.
| |||||||||||
Parse a Date from the specified String starting at the index specified by
the ParsePosition.
| |||||||||||
Parse a Date from the specified String starting at the index specified by
the ParsePosition.
| |||||||||||
Sets the Calendar used by this DateFormat.
| |||||||||||
Sets if the Calendar used by this DateFormat is lenient.
| |||||||||||
Sets the NumberFormat used by this DateFormat.
| |||||||||||
Sets the TimeZone of the Calendar used by this DateFormat.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.text.Format
| |||||||||||
From class java.lang.Object
| |||||||||||
Field constant.
Field constant.
Field constant.
Field constant.
Field constant.
Format style constant.
Field constant.
Format style constant.
Field constant.
Field constant.
Field constant.
Field constant.
Format style constant.
Format style constant.
Field constant.
Field constant.
Field constant.
Field constant.
Format style constant.
Field constant.
Field constant.
Field constant.
Field constant.
The calendar that this DateFormat uses to format a number
representing a date.
The number format used to format a number.
Constructs a new instance of DateFormat.
Returns a new instance of DateFormat with the same properties.
Compares the specified object to this DateFormat and answer if they are equal. The object must be an instance of DateFormat with the same properties.
| object | the object to compare with this object |
|---|
Formats the specified object into the specified StringBuffer using the rules of this DateFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
| object | the object to format, must be a Date or a Number. If the
object is a Number, a Date is constructed using the
longValue() of the Number. |
|---|---|
| buffer | the StringBuffer |
| field | the FieldPosition |
buffer| IllegalArgumentException | when the object is not a Date or a Number |
|---|
Formats the specified Date using the rules of this DateFormat.
| date | the Date to format |
|---|
Formats the specified Date into the specified StringBuffer using the rules of this DateFormat. If the field specified by the FieldPosition is formatted, set the begin and end index of the formatted field in the FieldPosition.
| date | the Date to format |
|---|---|
| buffer | the StringBuffer |
| field | the FieldPosition |
buffer
Gets the list of installed Locales which support DateFormat.
Returns the Calendar used by this DateFormat.
Returns a DateFormat instance for formatting and parsing dates in the specified style for the specified Locale.
| style | one of SHORT, MEDIUM, LONG, FULL, or DEFAULT |
|---|---|
| locale | the Locale |
Returns a DateFormat instance for formatting and parsing dates in the DEFAULT style for the default Locale.
Returns a DateFormat instance for formatting and parsing dates in the specified style for the default Locale.
| style | one of SHORT, MEDIUM, LONG, FULL, or DEFAULT |
|---|
Returns a DateFormat instance for the formatting and
parsing of both dates and times in the manner appropriate to the default
Locale.
| dateStyle | one of SHORT, MEDIUM, LONG, FULL, or DEFAULT |
|---|---|
| timeStyle | one of SHORT, MEDIUM, LONG, FULL, or DEFAULT |
Returns a DateFormat instance for formatting and parsing dates and times in the specified styles for the specified Locale.
| dateStyle | one of SHORT, MEDIUM, LONG, FULL, or DEFAULT |
|---|---|
| timeStyle | one of SHORT, MEDIUM, LONG, FULL, or DEFAULT |
| locale | the Locale |
Returns a DateFormat instance for formatting and parsing dates and times in the DEFAULT style for the default Locale.
Returns a DateFormat instance for formatting and parsing dates and times in the SHORT style for the default Locale.
Returns the NumberFormat used by this DateFormat.
Returns a DateFormat instance for formatting and parsing times in the specified style for the default Locale.
| style | one of SHORT, MEDIUM, LONG, FULL, or DEFAULT |
|---|
Returns a DateFormat instance for formatting and parsing times in the DEFAULT style for the default Locale.
Returns a DateFormat instance for formatting and parsing times in the specified style for the specified Locale.
| style | one of SHORT, MEDIUM, LONG, FULL, or DEFAULT |
|---|---|
| locale | the Locale |
Returns the TimeZone of the Calendar used by this DateFormat.
Returns an integer hash code for the receiver. Objects which are equal answer the same value for this method.
Returns if the Calendar used by this DateFormat is lenient.
Parse a Date from the specified String using the rules of this DateFormat.
| string | the String to parse |
|---|
| ParseException | when an error occurs during parsing |
|---|
Parse a Date from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
| string | the String to parse |
|---|---|
| position | the ParsePosition, updated on return with the index following the parsed text, or on error the index is unchanged and the error index is set to the index where the error occurred |
Parse a Date from the specified String starting at the index specified by the ParsePosition. If the string is successfully parsed, the index of the ParsePosition is updated to the index following the parsed text.
| string | the String to parse |
|---|---|
| position | the ParsePosition, updated on return with the index following the parsed text, or on error the index is unchanged and the error index is set to the index where the error occurred |
Sets the Calendar used by this DateFormat.
| cal | the Calendar |
|---|
Sets if the Calendar used by this DateFormat is lenient.
| value | true to set the Calendar to be lenient, false otherwise |
|---|
Sets the NumberFormat used by this DateFormat.
| format | the NumberFormat |
|---|
Sets the TimeZone of the Calendar used by this DateFormat.
| timezone | the TimeZone |
|---|