Java Date Time - DayOfWeek FRIDAY example








DayOfWeek FRIDAY defines the instance for the day-of-week of Friday. This has the numeric value of 5.

Syntax

FRIDAY has the following syntax.

public static final DayOfWeek FRIDAY

Example

The following example shows how to use FRIDAY.

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

The code above generates the following result.