Java Date Time Java Java API
Class:
java.time.DayOfWeek
Method:
public DayOfWeek plus(long days)
Returns the day-of-week added 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 subtracted rather than being added.
Examples:
package com.logicbig.example.dayofweek;
import java.time.DayOfWeek;
public class PlusExample {
public static void main (String[] args) { DayOfWeek d = DayOfWeek.MONDAY.plus(4); System.out.println(d);
d = DayOfWeek.MONDAY.plus(20); System.out.println(d);
d = DayOfWeek.MONDAY.plus(-2); System.out.println(d); } }
OutputFRIDAY SUNDAY SATURDAY
|