Java Date Time - DayOfWeek MONDAY example








DayOfWeek MONDAY defines the instance for the day-of-week of Monday. This has the numeric value of 1.

Syntax

MONDAY has the following syntax.

public static final DayOfWeek MONDAY

Example

The following example shows how to use MONDAY.

import java.time.DayOfWeek;
//  ww  w .j ava2 s  . co m
public class Main {
  public static void main(String[] args) {
    DayOfWeek dayOfWeek = DayOfWeek.MONDAY;
    System.out.println(dayOfWeek.name());
    System.out.println(dayOfWeek.getValue());
    System.out.println(dayOfWeek.ordinal());
  }
}

The code above generates the following result.