SimpleDateFormat (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Cloneable
-
Nested Class Summary
Nested classes/interfaces declared in class DateFormat
static classDefines constants that are used as attribute keys in the
AttributedCharacterIteratorreturned fromDateFormat.formatToCharacterIteratorand as field identifiers inFieldPosition. -
Field Summary
Fields declared in class 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_FIELDstatic final intUseful constant for AM_PM field alignment.
The
Calendarinstance used for calculating the date-time fields and the instant of time.static final intUseful constant for DATE field alignment.
static final intUseful constant for DAY_OF_WEEK field alignment.
static final intUseful constant for DAY_OF_WEEK_IN_MONTH field alignment.
static final intUseful constant for DAY_OF_YEAR field alignment.
static final intConstant for default style pattern.
static final intUseful constant for ERA field alignment.
static final intConstant for full style pattern.
static final intUseful constant for zero-based HOUR_OF_DAY field alignment.
static final intUseful constant for one-based HOUR_OF_DAY field alignment.
static final intUseful constant for zero-based HOUR field alignment.
static final intUseful constant for one-based HOUR field alignment.
static final intConstant for long style pattern.
static final intConstant for medium style pattern.
static final intUseful constant for MILLISECOND field alignment.
static final intUseful constant for MINUTE field alignment.
static final intUseful constant for MONTH field alignment.
The number formatter that
DateFormatuses to format numbers in dates and times.static final intUseful constant for SECOND field alignment.
static final intConstant for short style pattern.
static final intUseful constant for TIMEZONE field alignment.
static final intUseful constant for WEEK_OF_MONTH field alignment.
static final intUseful constant for WEEK_OF_YEAR field alignment.
static final intUseful constant for YEAR field alignment.
-
Constructor Summary
Constructors
Constructs a
SimpleDateFormatusing the default pattern and date format symbols for the defaultFORMATlocale.Constructs a
SimpleDateFormatusing the given pattern and the default date format symbols for the defaultFORMATlocale.Constructs a
SimpleDateFormatusing the given pattern and date format symbols.Constructs a
SimpleDateFormatusing the given pattern and the default date format symbols for the given locale. -
Method Summary
voidApplies the given localized pattern string to this date format.
voidApplies the given pattern string to this date format.
clone()Creates a copy of this
SimpleDateFormat.booleanCompares the specified object with this
SimpleDateFormatfor equality.Formats the given
Dateinto a date/time string and appends the result to the givenStringBuffer.Formats an Object producing an
AttributedCharacterIterator.Returns the beginning date of the 100-year period 2-digit years are interpreted as being within.
Gets a copy of the date and time format symbols of this date format.
inthashCode()Returns the hash code value for this
SimpleDateFormat.Parses text from a string to produce a
Date.voidSets the 100-year period 2-digit years will be interpreted as being in to begin on the date the user specifies.
voidSets the date and time format symbols of this date format.
Returns a localized pattern string describing this date format.
Returns a pattern string describing this date format.
toString()Returns a string identifying this
SimpleDateFormat, for debugging.Methods declared in class DateFormat
format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, getTimeZone, isLenient, parse, parseObject, setCalendar, setLenient, setNumberFormat, setTimeZoneFormats the given
Objectinto a date-time string.Formats a
Dateinto a date-time string.Returns an array of all locales for which the
get*Instancemethods of this class can return localized instances.Gets the calendar associated with this date/time formatter.
Gets the date formatter with the default formatting style for the default
FORMATlocale.Gets the date formatter with the given formatting style for the default
FORMATlocale.Gets the date formatter with the given formatting style for the given locale.
Gets the date/time formatter with the default formatting style for the default
FORMATlocale.Gets the date/time formatter with the given date and time formatting styles for the default
FORMATlocale.Gets the date/time formatter with the given formatting styles for the given locale.
Get a default date/time formatter that uses the SHORT style for both the date and the time.
Gets the number formatter which this date/time formatter uses to format and parse a time.
Gets the time formatter with the default formatting style for the default
FORMATlocale.Gets the time formatter with the given formatting style for the default
FORMATlocale.Gets the time formatter with the given formatting style for the given locale.
booleanTell whether date/time parsing is to be lenient.
Parses text from the beginning of the given string to produce a date.
Parses text from a string to produce a
Date.voidSet the calendar to be used by this date format.
voidSpecify whether or not date/time parsing is to be lenient.
voidAllows you to set the number formatter.
voidSets the time zone for the calendar of this
DateFormatobject.Methods declared in class Format
Formats an object to produce a string.
Parses text from the beginning of the given string to produce an object.
Methods declared in class Object
finalize, getClass, notify, notifyAll, wait, wait, waitprotected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
SimpleDateFormat
-
SimpleDateFormat
-
SimpleDateFormat
-
SimpleDateFormat
-
-
Method Details
-
set2DigitYearStart
-
get2DigitYearStart
-
format
-
formatToCharacterIterator
-
parse
-
toPattern
-
toLocalizedPattern
-
applyPattern
-
applyLocalizedPattern
-
getDateFormatSymbols
-
setDateFormatSymbols
-
clone
-
hashCode
-
toString
-
equals
-