Java Date Time - DayOfWeek WEDNESDAY example








DayOfWeek WEDNESDAY defines the instance for the day-of-week of Wednesday. This has the numeric value of 3.

Syntax

WEDNESDAY has the following syntax.

public static final DayOfWeek WEDNESDAY

Example

The following example shows how to use WEDNESDAY.

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

The code above generates the following result.