Java Date Time - DayOfWeek SUNDAY example








DayOfWeek SUNDAY is the constant for the day-of-week of Sunday. This has the numeric value of 7.

Syntax

SUNDAY has the following syntax.

public static final DayOfWeek SUNDAY

Example

The following example shows how to use SUNDAY.

import java.time.DayOfWeek;
/* ww w  .  j  av a 2 s  .com*/
public class Main {
  public static void main(String[] args) {
    DayOfWeek dayOfWeek = DayOfWeek.SUNDAY;
    System.out.println(dayOfWeek.name());
    System.out.println(dayOfWeek.getValue());
    System.out.println(dayOfWeek.ordinal());
  }
}

The code above generates the following result.