Java DayOfWeek minus day from day of week

Description

Java DayOfWeek minus day from day of week

import java.time.DayOfWeek;

public class Main {
  public static void main(String[] args) {
    // Obtain a DayOfWeek instance using an int value
    DayOfWeek dw2 = DayOfWeek.of(7); // SUNDAY
    System.out.println(dw2);/*w  w w.  j  ava 2 s .  co  m*/
    
    // Get the day-of-week two days ago
    DayOfWeek dw4 = dw2.minus(2); // FRIDAY
    System.out.println(dw4);
    
  }
}



PreviousNext

Related