Java Date Time Java Java API
Class:
java.time.DayOfWeek
Method:
public DayOfWeek minus(long days)
Returns the day-of-week subtracted by specified number of days
If the specified number is more than 7 then the calculation rolls around.
If the specified number is negative then days are added rather than being subtracted.
Examples:
package com.logicbig.example.dayofweek;
import java.time.DayOfWeek;
public class MinusExample { public static void main (String[] args) { DayOfWeek d = DayOfWeek.MONDAY.minus(4); System.out.println(d);
d = DayOfWeek.MONDAY.minus(20); System.out.println(d);
d = DayOfWeek.MONDAY.minus(-2); System.out.println(d); } }
OutputTHURSDAY TUESDAY WEDNESDAY
|