GeezerVison is showing docs.oracle.com — SimpleDateFormat (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.text
Class SimpleDateFormat
-
-
Field Summary
-
Fields inherited from class java.text.DateFormat
AM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD
-
Constructor Summary
Constructors
| Constructor |
Description |
SimpleDateFormat() |
Constructs a SimpleDateFormat using the default pattern and
date format symbols for the default
FORMAT locale.
|
SimpleDateFormat(String pattern) |
Constructs a SimpleDateFormat using the given pattern and
the default date format symbols for the default
FORMAT locale.
|
SimpleDateFormat(String pattern,
DateFormatSymbols formatSymbols) |
Constructs a SimpleDateFormat using the given pattern and
date format symbols.
|
SimpleDateFormat(String pattern,
Locale locale) |
Constructs a SimpleDateFormat using the given pattern and
the default date format symbols for the given locale.
|
-
Method Summary
-
Methods inherited from class java.text.DateFormat
format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZone
-
-
Constructor Detail
-
SimpleDateFormat
public SimpleDateFormat(String pattern,
DateFormatSymbols formatSymbols)
Constructs a SimpleDateFormat using the given pattern and
date format symbols.
- Parameters:
pattern - the pattern describing the date and time format
formatSymbols - the date format symbols to be used for formatting
- Throws:
NullPointerException - if the given pattern or formatSymbols is null
IllegalArgumentException - if the given pattern is invalid
-
Method Detail
-
format
public StringBuffer format(Date date,
StringBuffer toAppendTo,
FieldPosition pos)
Formats the given Date into a date/time string and appends
the result to the given StringBuffer.
- Specified by:
format in class DateFormat
- Parameters:
date - the date-time value to be formatted into a date-time string.
toAppendTo - where the new date-time text is to be appended.
pos - the formatting position. On input: an alignment field,
if desired. On output: the offsets of the alignment field.
- Returns:
- the formatted date-time string.
- Throws:
NullPointerException - if the given date is null.
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|