Finding day value on Dec 15, 1995.
package com.logicbig.example.dayofweek;
import java.time.LocalDate;
import java.time.Month;
public class GetValueExample {
public static void main (String[] args) {
int value = LocalDate.of(1995, Month.DECEMBER, 15)
.getDayOfWeek()
.getValue();
System.out.println(value);
}
}
Output
5
This example finds out what will be the day on the same date after one year.
package com.logicbig.example.dayofweek;
import java.time.DayOfWeek;
import java.time.LocalDate;
public class GetValueExample2 {
public static void main (String[] args) {
DayOfWeek day = LocalDate.now()
.plusYears(1)
.getDayOfWeek();
System.out.println(day);
System.out.println(day.getValue());
}
}
Output
TUESDAY
2