DateFormat (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, Cloneable
- Direct Known Subclasses:
SimpleDateFormat
-
Nested Class Summary
Nested Classes
static classDefines constants that are used as attribute keys in the
AttributedCharacterIteratorreturned fromDateFormat.formatToCharacterIteratorand as field identifiers inFieldPosition. -
Field Summary
Fields
static 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
protectedCreate a new date format.
-
Method Summary
clone()booleanCompares the specified object with this
DateFormatfor equality.Formats the given
Objectinto a date-time string.Formats a
Dateinto 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.getDateInstance(int style) 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.getDateTimeInstance(int dateStyle, int timeStyle) Gets the date/time formatter with the given date and time formatting styles for the default
FORMATlocale.getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) 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.getTimeInstance(int style) 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.
inthashCode()Returns the hash code for this
DateFormat.booleanTell whether date/time parsing is to be lenient.
Parses text from the beginning of the given string to produce a date.
Parse a date/time string according to the given parse position.
Parses text from a string to produce a
Date.voidSet the calendar to be used by this date format.
voidsetLenient(boolean lenient) Specify 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
format, formatToCharacterIterator, parseObjectFormats an object to produce a string.
Formats an Object producing an
AttributedCharacterIterator.Parses text from the beginning of the given string to produce an object.
Methods declared in class Object
finalize, getClass, notify, notifyAll, toString, 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.
Returns a string representation of the object.
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.
-
Field Details
-
calendar
-
numberFormat
-
ERA_FIELD
-
YEAR_FIELD
-
MONTH_FIELD
-
DATE_FIELD
-
HOUR_OF_DAY1_FIELD
-
HOUR_OF_DAY0_FIELD
-
MINUTE_FIELD
-
SECOND_FIELD
-
MILLISECOND_FIELD
-
DAY_OF_WEEK_FIELD
-
DAY_OF_YEAR_FIELD
-
DAY_OF_WEEK_IN_MONTH_FIELD
-
WEEK_OF_YEAR_FIELD
-
WEEK_OF_MONTH_FIELD
-
AM_PM_FIELD
-
HOUR1_FIELD
-
HOUR0_FIELD
-
TIMEZONE_FIELD
-
FULL
-
LONG
-
MEDIUM
-
SHORT
-
DEFAULT
-
-
Constructor Details
-
DateFormat
-
-
Method Details
-
format
-
format
-
format
-
parse
-
parse
-
parseObject
-
getTimeInstance
-
getTimeInstance
-
getTimeInstance
-
getDateInstance
-
getDateInstance
-
getDateInstance
-
getDateTimeInstance
-
getDateTimeInstance
-
getDateTimeInstance
-
getInstance
-
getAvailableLocales
-
setCalendar
-
getCalendar
-
setNumberFormat
-
getNumberFormat
-
setTimeZone
-
getTimeZone
-
setLenient
-
isLenient
-
hashCode
-
equals
-
clone
-