This method adjusts the provided temporal object forwards or backwards within a Monday to Sunday week (week starts from MONDAY and ends at SUNDAY).
If this DayOfWeek is before day field of the provided temporal then resultant temporal will be pushed backwards otherwise forward.
In this example the resultant temporal is pushed backwards from the provided localDate.
public class AdjustIntoExample2 {
public static void main (String[] args) {
LocalDate localDate = LocalDate.of(2016, 11, 30);
Temporal t = DayOfWeek.MONDAY
.adjustInto(localDate);
System.out.println(t);
}
}
Output
2016-11-28
In this example the resultant temporal is pushed forward from the provided localDate because SATURDAY is still ahead of the day portion of 2016-11-01 which is Tuesday.
public class AdjustIntoExample3 {
public static void main (String[] args) {
LocalDate localDate = LocalDate.of(2016, 11, 01);
System.out.println("day in localDate: " + localDate.getDayOfWeek());
Temporal t = DayOfWeek.SATURDAY
.adjustInto(localDate);
System.out.println(t);
}
}
Output
day in localDate: TUESDAY
2016-11-05