A day-of-week, such as 'Tuesday'.
DayOfWeek
is an enum representing the 7 days of the week -
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.
In addition to the textual enum name, each day-of-week has an int
value.
The int
value follows the ISO-8601 standard, from 1 (Monday) to 7 (Sunday).
It is recommended that applications use the enum rather than the int
value
to ensure code clarity.
This enum provides access to the localized textual form of the day-of-week.
Some locales also assign different numeric values to the days, declaring
Sunday to have the value 1, however this class provides no support for this.
See WeekFields
for localized week-numbering.
Do not use ordinal()
to obtain the numeric representation of DayOfWeek
.
Use getValue()
instead.
This enum represents a common concept that is found in many calendar systems.
As such, this enum may be used by any calendar system that has the day-of-week
concept defined exactly equivalent to the ISO calendar system.
Inherited Method Summary
From class
java.lang.Enum
final
Object
|
clone()
Throws CloneNotSupportedException.
|
final
int
|
|
final
boolean
|
equals( Object other)
Returns true if the specified object is equal to this
enum constant.
|
final
void
|
finalize()
enum classes cannot have finalize methods.
|
final
Class<DayOfWeek>
|
getDeclaringClass()
Returns the Class object corresponding to this enum constant's
enum type.
|
final
int
|
hashCode()
Returns a hash code for this enum constant.
|
final
String
|
name()
Returns the name of this enum constant, exactly as declared in its
enum declaration.
|
final
int
|
ordinal()
Returns the ordinal of this enumeration constant (its position
in its enum declaration, where the initial constant is assigned
an ordinal of zero).
|
String
|
toString()
Returns the name of this enum constant, as contained in the
declaration.
|
static
<T extends Enum<T>>
T
|
valueOf( Class<T> enumType, String name)
Returns the enum constant of the specified enum type with the
specified name.
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals( Object obj)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait(long timeout, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long timeout)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
Enum Values
public
static
final
DayOfWeek
FRIDAY
The singleton instance for the day-of-week of Friday.
This has the numeric value of 5
.
public
static
final
DayOfWeek
MONDAY
The singleton instance for the day-of-week of Monday.
This has the numeric value of 1
.
public
static
final
DayOfWeek
SATURDAY
The singleton instance for the day-of-week of Saturday.
This has the numeric value of 6
.
public
static
final
DayOfWeek
SUNDAY
The singleton instance for the day-of-week of Sunday.
This has the numeric value of 7
.
public
static
final
DayOfWeek
THURSDAY
The singleton instance for the day-of-week of Thursday.
This has the numeric value of 4
.
public
static
final
DayOfWeek
TUESDAY
The singleton instance for the day-of-week of Tuesday.
This has the numeric value of 2
.
public
static
final
DayOfWeek
WEDNESDAY
The singleton instance for the day-of-week of Wednesday.
This has the numeric value of 3
.