Java LocalDate getDayOfWeek() Method
Example
Find the day of the week for a date:
import java.time.LocalDate;
public class Main {
public static void main(String[] args) {
LocalDate myDate = LocalDate.of(2026, 1, 15);
System.out.println(myDate.getDayOfWeek());
}
}
Definition and Usage
The getDayOfWeek() method returns the day of the week of the date, as a DayOfWeek value.
DayOfWeek is an enum (a fixed list of values) with the seven days, from MONDAY to SUNDAY. When you print it, the name is shown in capital letters.
Syntax
public DayOfWeek getDayOfWeek()
Parameter Values
None.
Technical Details
| Returns: | The day of the week, as a DayOfWeek value, for example THURSDAY. |
|---|
Related Pages
❮ Date and Time Methods