SimpleDateFormat
public
class
SimpleDateFormat
extends DateFormat
| java.lang.Object | ||||
| ↳ | java.text.Format | |||
| ↳ | android.icu.text.UFormat | |||
| ↳ | android.icu.text.DateFormat | |||
| ↳ | android.icu.text.SimpleDateFormat | |||
[icu enhancement] ICU's replacement for SimpleDateFormat. Methods, fields, and other functionality specific to ICU are labeled '[icu]'.
SimpleDateFormat is a concrete class for formatting and
parsing dates in a locale-sensitive manner. It allows for formatting
(date -> text), parsing (text -> date), and normalization.
Clients are encouraged to create a date-time formatter using
DateFormat.getDateInstance(), DateFormat.getDateInstance(),
or DateFormat.getDateTimeInstance() rather than
explicitly constructing an instance of SimpleDateFormat. This way, the client
is guaranteed to get an appropriate formatting pattern for whatever locale the
program is running in. If the client needs more control, they should consider using
DateFormat.getInstanceForSkeleton().
However, if the client needs something more unusual than
the default patterns in the locales, he can construct a SimpleDateFormat directly
and give it an appropriate pattern (or use one of the factory methods on DateFormat
and modify the pattern after the fact with toPattern() and applyPattern().
For more information on using these methods, see
DateFormat.
Date and Time Patterns:
Date and time formats are specified by date and time pattern strings. The full syntax for date and time patterns can be found at https://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns.
Within date and time pattern strings, all unquoted ASCII letters [A-Za-z] are reserved as pattern letters representing calendar fields. Some of the most commonly used pattern letters are:
Sym. No. Example Description G 1..3 A