DayOfWeek minus(long days) example
Description
DayOfWeek minus(long days)
returns
the day-of-week that is the specified number of days before this one.
Syntax
minus
has the following syntax.
public DayOfWeek minus(long days)
Example
The following example shows how to use minus
.
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.Month;
//from www . j a va 2 s.c om
public class Main {
public static void main(String[] args) {
LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
System.out.println(dayOfWeek.getValue());
dayOfWeek = dayOfWeek.minus(2);
System.out.println(dayOfWeek.getValue());
}
}
The code above generates the following result.