- java.time - Home
- java.time - Clock
- java.time - Duration
- java.time - Instant
- java.time - LocalDate
- java.time - LocalDateTime
- java.time - LocalTime
- java.time - MonthDay
- java.time - OffsetDateTime
- java.time - OffsetTime
- java.time - Period
- java.time - Year
- java.time - YearMonth
- java.time - ZonedDateTime
- java.time - ZoneId
- java.time - ZoneOffset
- java.time Package Enums
- java.time - Month
- java.time Useful Resources
- java.time - Discussion
java.time.DayOfWeek Enum
Introduction
The java.time.DayOfWeek Enum represents a day-of-week, such as 'Tuesday'.
Class declaration
Following is the declaration for java.time.DayOfWeek Enum −
public enum DayOfWeek
extends Enum<DayOfWeek>
implements TemporalAccessor, TemporalAdjuster
Enum Constants
Following are the fields for Java.time.DayOfWeek Enum −
MONDAY − The singleton instance for the day-of-week of Monday.
TUESDAY − The singleton instance for the day-of-week of Tuesday.
WEDNESDAY − The singleton instance for the day-of-week of Wednesday.
THURSDAY − The singleton instance for the day-of-week of Thursday.
FRIDAY − The singleton instance for the day-of-week of Friday.
SATURDAY − The singleton instance for the day-of-week of Saturday.
SUNDAY − The singleton instance for the day-of-week of Sunday.
Enum methods
| Sr.No. | Method & Description |
|---|---|
| 1 | Temporal adjustInto(Temporal temporal)
Adjusts the specified temporal object to have the same day-of-week as this object. |
| 2 | static DayOfWeek from(TemporalAccessor temporal)
Obtains an instance of DayOfWeek from a temporal object. |
| 3 | int get(TemporalField field)
Gets the value of the specified field from this day-of-week as an int. |
| 4 | String getDisplayName(TextStyle style, Locale locale)
Gets the textual representation, such as 'Mon' or 'Friday'. |
| 5 | long getLong(TemporalField field)
Gets the value of the specified field from this day-of-week as a long. |
| 6 | int getValue()
Gets the day-of-week int value. |
| 7 | boolean isSupported(TemporalField field)
Checks if the specified field is supported. |
| 8 | DayOfWeek minus(long days)
Returns the day-of-week that is the specified number of days before this one. |
| 9 | static DayOfWeek of(int dayOfWeek)
Obtains an instance of DayOfWeek from an int value. |
| 10 | DayOfWeek plus(long days)
Returns the day-of-week that is the specified number of days after this one. |
| 11 | <R> R query(TemporalQuery<R> query)
Queries this offset using the specified query. |
| 12 | ValueRange range(TemporalField field)
Gets the range of valid values for the specified field. |
| 13 | static DayOfWeek valueOf(String name)
Returns the enum constant of this type with the specified name. |
| 14 | static DayOfWeek[] values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited
This class inherits methods from the following classes −
- Java.lang.Enum
- Java.lang.Object