LocalDateTime getDayOfWeek() method in Java with Examples
The getDayOfWeek() method of an LocalDateTime class is used to return the day-of-week field, which is an enum DayOfWeek. This method returns the enum DayOfWeek for the day-of-week.
public DayOfWeek getDayOfWeek()
Parameter: This method do not accepts any parameter.
Returns: This method returns the day-of-week from the enum DayOfWeek.
Below programs illustrate the LocalDateTime.getDayOfWeek() method:
Day of Week: MONDAY
Day of Week: SATURDAY
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.