| java.lang.Object | |||
| ↳ | java.text.Format | ||
| ↳ | java.text.DateFormat | ||
| ↳ | java.text.SimpleDateFormat | ||
SimpleDateFormat is used to format and parse Gregorian calendar dates and times based on a pattern of date and time fields. Each date and time field is specified in the pattern by a specific character. The characters used can be either localized or non-localized. For some fields, which have both numeric and text representations or abbreviated as well as full names, the number of grouped characters specifies how the field is formatted or parsed.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.text.DateFormat
| |||||||||||
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.text.DateFormat
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new SimpleDateFormat for formatting and parsing dates and
times in the SHORT style for the default Locale.
| |||||||||||
Constructs a new SimpleDateFormat using the specified non-localized
pattern and the DateFormatSymbols and Calendar for the default Locale.
| |||||||||||
Constructs a new SimpleDateFormat using the specified non-localized
pattern and DateFormatSymbols and the Calendar for the default Locale.
| |||||||||||
Constructs a new SimpleDateFormat using the specified non-localized
pattern and the DateFormatSymbols and Calendar for the specified Locale.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Changes the pattern of this SimpleDateFormat to the specified pattern
which uses localized pattern characters.
| |||||||||||
Changes the pattern of this SimpleDateFormat to the specified pattern
which uses non-localized pattern characters.
| |||||||||||
Returns a new SimpleDateFormat with the same pattern and properties as
this SimpleDateFormat.
| |||||||||||
Compares the specified object to this SimpleDateFormat and answer if they
are equal.
| |||||||||||
Formats the specified Date into the specified StringBuffer using the
pattern of this SimpleDateFormat.
| |||||||||||
Formats the specified object using the rules of this SimpleDateFormat and
returns an AttributedCharacterIterator with the formatted Date and
attributes.
| |||||||||||
Returns the Date which is the start of the one hundred year period for
two digits year values.
| |||||||||||
Returns the DateFormatSymbols used by this SimpleDateFormat.
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
Parse a Date from the specified String starting at the index specified by
the ParsePosition.
| |||||||||||
Sets the Date which is the start of the one hundred year period for two
digits year values.
| |||||||||||
Sets the DateFormatSymbols used by this SimpleDateFormat.
| |||||||||||
Returns the pattern of this SimpleDateFormat using localized pattern
characters.
| |||||||||||
Returns the pattern of this SimpleDateFormat using non-localized pattern
characters.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.text.DateFormat
| |||||||||||
From class java.text.Format
| |||||||||||
From class java.lang.Object
| |||||||||||
Constructs a new SimpleDateFormat for formatting and parsing dates and times in the SHORT style for the default Locale.
Constructs a new SimpleDateFormat using the specified non-localized pattern and the DateFormatSymbols and Calendar for the default Locale.
| pattern | the pattern |
|---|
| NullPointerException | if a null value of pattern
is supplied. |
|---|---|
| IllegalArgumentException | if pattern is not considered to be useable
by this formatter.
|
Constructs a new SimpleDateFormat using the specified non-localized pattern and DateFormatSymbols and the Calendar for the default Locale.
| template | the pattern |
|---|---|
| value | the DateFormatSymbols |
| NullPointerException | if the pattern is null |
|---|---|
| IllegalArgumentException | if the pattern is invalid |
Constructs a new SimpleDateFormat using the specified non-localized pattern and the DateFormatSymbols and Calendar for the specified Locale.
| template | the pattern |
|---|---|
| locale | the Locale |
| NullPointerException | if the pattern is null |
|---|---|
| IllegalArgumentException | if the pattern is invalid |
Changes the pattern of this SimpleDateFormat to the specified pattern which uses localized pattern characters.
| template | the localized pattern |
|---|
Changes the pattern of this SimpleDateFormat to the specified pattern which uses non-localized pattern characters.
| template | the non-localized pattern |
|---|
| NullPointerException | if the pattern is null |
|---|---|
| IllegalArgumentException | if the pattern is invalid |
Returns a new SimpleDateFormat with the same pattern and properties as this SimpleDateFormat.
Compares the specified object to this SimpleDateFormat and answer if they are equal. The object must be an instance of SimpleDateFormat and have the same DateFormat properties, pattern, DateFormatSymbols, and creation year.
| object | the object to compare with this object |
|---|
Formats the specified Date into the specified StringBuffer using the pattern of this SimpleDateFormat. 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| IllegalArgumentException | when there are invalid characters in the pattern |
|---|
Formats the specified object using the rules of this SimpleDateFormat and returns an AttributedCharacterIterator with the formatted Date and attributes.
| object | the object to format |
|---|
| NullPointerException | when the object is null |
|---|---|
| IllegalArgumentException | when the object cannot be formatted by this Format |
Returns the Date which is the start of the one hundred year period for two digits year values.
Returns the DateFormatSymbols used by this SimpleDateFormat.
Returns an integer hash code for the receiver. Objects which are equal answer the same value for this method.
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 according to the pattern of this SimpleDateFormat |
|---|---|
| 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 |
| IllegalArgumentException | when there are invalid characters in the pattern |
|---|
Sets the Date which is the start of the one hundred year period for two digits year values.
| date | the Date |
|---|
Sets the DateFormatSymbols used by this SimpleDateFormat.
| value | the DateFormatSymbols |
|---|
Returns the pattern of this SimpleDateFormat using localized pattern characters.
Returns the pattern of this SimpleDateFormat using non-localized pattern characters.