Java Date Time - ZonedDateTime getDayOfWeek() example

ZonedDateTime getDayOfWeek() gets the day-of-week field, which is an enum DayOfWeek. This method returns the enum DayOfWeek for the day-of-week. This avoids confusion as to what int values mean. If you need access to the primitive int value then the enum provides the int value. Additional information can be obtained from the DayOfWeek. This includes textual names of the values.


getDayOfWeek has the following syntax.

public DayOfWeek getDayOfWeek()


The following example shows how to use getDayOfWeek.

import java.time.ZonedDateTime;

public class Main {
  public static void main(String[] args) {
    ZonedDateTime dateTime;


The code above generates the following result.