Java DayOfWeek get int value of day of week

Description

Java DayOfWeek get int value of day of week

import java.time.DayOfWeek;
import java.time.LocalDate;

public class Main {
  public static void main(String[] args) {
    LocalDate ld = LocalDate.now();
    DayOfWeek dw1 = DayOfWeek.from(ld);

    // Get the int value of the day-of-week
    int d = dw1.getValue();
    System.out.println(d);/*  w ww  .  j  a va2s.c o  m*/
  }
}



PreviousNext

Related