java.text
public abstract class DateFormat extends Format implements Cloneable
UNKNOWN: October 25, 1998.
Nested Class Summary | |
---|---|
static class | DateFormat.Field |
Field Summary | |
---|---|
static int | AM_PM_FIELD
Represents the position of the am/pm
pattern character in the array of
localized pattern characters.
|
protected Calendar | calendar |
static int | DATE_FIELD
Represents the position of the date
or day of the month pattern character
in the array of localized pattern
characters. |
static int | DAY_OF_WEEK_FIELD
Represents the position of the day of the
week pattern character in the array of
localized pattern characters.
|
static int | DAY_OF_WEEK_IN_MONTH_FIELD
Represents the position of the day of the
week in the month pattern character in the
array of localized pattern characters.
|
static int | DAY_OF_YEAR_FIELD
Represents the position of the day of the
year pattern character in the array of
localized pattern characters.
|
static int | DEFAULT |
static int | ERA_FIELD
Represents the position of the era
pattern character in the array of
localized pattern characters.
|
static int | EXTENDED_YEAR_FIELD
Represents the position of the extended year
pattern character in the array of
localized pattern characters.
|
static int | FULL |
static int | HOUR0_FIELD
Represents the position of the 12
hour pattern character in the array of
localized pattern characters.
|
static int | HOUR1_FIELD
Represents the position of the 12
hour pattern character in the array of
localized pattern characters.
|
static int | HOUR_OF_DAY0_FIELD
Represents the position of the 24
hour pattern character in the array of
localized pattern characters.
|
static int | HOUR_OF_DAY1_FIELD
Represents the position of the 24
hour pattern character in the array of
localized pattern characters.
|
static int | ISO_YEAR_FIELD
Represents the position of the ISO year
pattern character in the array of
localized pattern characters.
|
static int | LOCALIZED_DAY_OF_WEEK_FIELD
Represents the position of the localized
day of the week pattern character in the
array of localized pattern characters.
|
static int | LONG |
static int | MEDIUM |
static int | MILLISECOND_FIELD
Represents the position of the millisecond
pattern character in the array of
localized pattern characters.
|
static int | MILLISECOND_IN_DAY_FIELD
Represents the position of the millisecond
in the day pattern character in the array of
localized pattern characters.
|
static int | MINUTE_FIELD
Represents the position of the minute
pattern character in the array of
localized pattern characters.
|
static int | MODIFIED_JULIAN_DAY_FIELD
Represents the position of the modified Julian
day pattern character in the array of
localized pattern characters.
|
static int | MONTH_FIELD
Represents the position of the month
pattern character in the array of
localized pattern characters.
|
protected NumberFormat | numberFormat |
static int | RFC822_TIMEZONE_FIELD
Represents the position of the RFC822
timezone pattern character in the array of
localized pattern characters.
|
static int | SECOND_FIELD
Represents the position of the second
pattern character in the array of
localized pattern characters.
|
static int | SHORT |
static int | TIMEZONE_FIELD
Represents the position of the generic
timezone pattern character in the array of
localized pattern characters.
|
static int | WEEK_OF_MONTH_FIELD
Represents the position of the week of the
month pattern character in the array of
localized pattern characters.
|
static int | WEEK_OF_YEAR_FIELD
Represents the position of the week of the
year pattern character in the array of
localized pattern characters.
|
static int | YEAR_FIELD
Represents the position of the year
pattern character in the array of
localized pattern characters.
|
Constructor Summary | |
---|---|
protected | DateFormat()
This method initializes a new instance of DateFormat . |
Method Summary | |
---|---|
Object | clone()
This method returns a copy of this object.
|
boolean | equals(Object obj)
This method tests this object for equality against the specified object.
|
StringBuffer | format(Object obj, StringBuffer buf, FieldPosition pos)
This method formats the specified Object into a date string
and appends it to the specified StringBuffer .
|
String | format(Date date)
Formats the date argument according to the pattern specified.
|
abstract StringBuffer | format(Date date, StringBuffer buf, FieldPosition pos)
This method formats a Date into a string and appends it
to the specified StringBuffer .
|
static Locale[] | getAvailableLocales()
This method returns a list of available locales supported by this
class. |
Calendar | getCalendar()
This method returns the Calendar object being used by
this object to parse/format datetimes.
|
static DateFormat | getDateInstance()
This method returns an instance of DateFormat that will
format using the default formatting style for dates.
|
static DateFormat | getDateInstance(int style)
This method returns an instance of DateFormat that will
format using the specified formatting style for dates.
|
static DateFormat | getDateInstance(int style, Locale loc)
This method returns an instance of DateFormat that will
format using the specified formatting style for dates. |
static DateFormat | getDateTimeInstance()
This method returns a new instance of DateFormat that
formats both dates and times using the SHORT style.
|
static DateFormat | getDateTimeInstance(int dateStyle, int timeStyle)
This method returns a new instance of DateFormat that
formats both dates and times using the DEFAULT style.
|
static DateFormat | getDateTimeInstance(int dateStyle, int timeStyle, Locale loc)
This method returns a new instance of DateFormat that
formats both dates and times using the specified styles.
|
static DateFormat | getInstance()
This method returns a new instance of DateFormat that
formats both dates and times using the SHORT style.
|
NumberFormat | getNumberFormat()
This method returns the NumberFormat object being used
by this object to parse/format time values.
|
static DateFormat | getTimeInstance()
This method returns an instance of DateFormat that will
format using the default formatting style for times.
|
static DateFormat | getTimeInstance(int style)
This method returns an instance of DateFormat that will
format using the specified formatting style for times.
|
static DateFormat | getTimeInstance(int style, Locale loc)
This method returns an instance of DateFormat that will
format using the specified formatting style for times. |
TimeZone | getTimeZone()
This method returns the TimeZone object being used by
this instance.
|
int | hashCode()
This method returns a hash value for this object.
|
boolean | isLenient()
This method indicates whether or not the parsing of date and time
values should be done in a lenient value.
|
Date | parse(String source)
This method parses the specified date/time string.
|
abstract Date | parse(String source, ParsePosition pos)
This method parses the specified String into a
Date . |
Object | parseObject(String source, ParsePosition pos)
This method is identical to parse(String, ParsePosition) ,
but returns its result as an Object instead of a
Date .
|
void | setCalendar(Calendar calendar)
This method specified the Calendar that should be used
by this object to parse/format datetimes.
|
void | setLenient(boolean lenient)
This method specifies whether or not this object should be lenient in
the syntax it accepts while parsing date/time values.
|
void | setNumberFormat(NumberFormat numberFormat)
This method specifies the NumberFormat object that should
be used by this object to parse/format times.
|
void | setTimeZone(TimeZone timeZone)
This method sets the time zone that should be used by this object.
|
DateFormat
.Returns: A copy of this object.
null
.DateFormat
.Parameters: obj The object to test for equality against.
Returns: true
if the specified object is equal to this object,
false
otherwise.
Object
into a date string
and appends it to the specified StringBuffer
.
The specified object must be an instance of Number
or
Date
or an IllegalArgumentException
will be
thrown.
Parameters: obj The Object
to format. buf The StringBuffer
to append the resultant
String
to. pos Is updated to the start and end index of the
specified field.
Returns: The StringBuffer
supplied on input, with the
formatted date/time appended.
Parameters: date The formatted date.
Date
into a string and appends it
to the specified StringBuffer
.
Parameters: date The Date
value to format. buf The StringBuffer
to append the resultant
String
to. pos Is updated to the start and end index of the
specified field.
Returns: The StringBuffer
supplied on input, with the
formatted date/time appended.
Calendar
object being used by
this object to parse/format datetimes.
Returns: The Calendar
being used by this object.
See Also: Calendar
DateFormat
that will
format using the default formatting style for dates.
Returns: A new DateFormat
instance.
DateFormat
that will
format using the specified formatting style for dates.
Parameters: style The type of formatting to perform.
Returns: A new DateFormat
instance.
DateFormat
that will
format using the specified formatting style for dates. The specified
localed will be used in place of the default.
Parameters: style The type of formatting to perform. loc The desired locale.
Returns: A new DateFormat
instance.
DateFormat
that
formats both dates and times using the SHORT
style.
Returns: A new DateFormat
instance.
DateFormat
that
formats both dates and times using the DEFAULT
style.
Returns: A new DateFormat
instance.
DateFormat
that
formats both dates and times using the specified styles.
Parameters: dateStyle The desired style for date formatting. timeStyle The desired style for time formatting
Returns: A new DateFormat
instance.
DateFormat
that
formats both dates and times using the SHORT
style.
Returns: A new DateFormat
instance.
NumberFormat
object being used
by this object to parse/format time values.
Returns: The NumberFormat
in use by this object.
DateFormat
that will
format using the default formatting style for times.
Returns: A new DateFormat
instance.
DateFormat
that will
format using the specified formatting style for times.
Parameters: style The type of formatting to perform.
Returns: A new DateFormat
instance.
DateFormat
that will
format using the specified formatting style for times. The specified
localed will be used in place of the default.
Parameters: style The type of formatting to perform. loc The desired locale.
Returns: A new DateFormat
instance.
TimeZone
object being used by
this instance.
Returns: The time zone in use.
Returns: A hash value for this object.
Returns: true
if date/time parsing is lenient,
false
otherwise.
Parameters: source The string to parse.
Returns: The resultant date.
Throws: ParseException If the specified string cannot be parsed.
String
into a
Date
. The pos
argument contains the
starting parse position on method entry and the ending parse
position on method exit.
Parameters: source The string to parse. pos The starting parse position in entry, the ending parse position on exit.
Returns: The parsed date, or null
if the string cannot
be parsed.
parse(String, ParsePosition)
,
but returns its result as an Object
instead of a
Date
.
Parameters: source The string to parse. pos The starting parse position in entry, the ending parse position on exit.
Returns: The parsed date, or null
if the string cannot
be parsed.
Calendar
that should be used
by this object to parse/format datetimes.
Parameters: calendar The new Calendar
for this object.
See Also: Calendar
Parameters: lenient true
if parsing should be lenient,
false
otherwise.
NumberFormat
object that should
be used by this object to parse/format times.
Parameters: numberFormat The NumberFormat
in use by this object.
Parameters: timeZone The new time zone.