Java Date Time - DayOfWeek TUESDAY example








DayOfWeek TUESDAY defines the instance for the day-of-week of Tuesday. This has the numeric value of 2.

Syntax

TUESDAY has the following syntax.

public static final DayOfWeek TUESDAY

Example

The following example shows how to use TUESDAY.

import java.time.DayOfWeek;
// w  ww.  j a v a2 s. c  o m
public class Main {
  public static void main(String[] args) {
    DayOfWeek dayOfWeek = DayOfWeek.TUESDAY;
    System.out.println(dayOfWeek.name());
    System.out.println(dayOfWeek.getValue());
    System.out.println(dayOfWeek.ordinal());
  }
}

The code above generates the following result.