This method subtracts the specified amount from the days field of the copy of this instance, if necessary adjusting the month and year fields to have a valid result.
package com.logicbig.example.localdatetime;
import java.time.LocalDateTime;
import java.time.Month;
public class MinusDaysExample {
public static void main (String... args) {
LocalDateTime d = LocalDateTime.of(2016, Month.DECEMBER, 12,
17, 10, 45);
LocalDateTime d2 = d.minusDays(300);
System.out.println(d2);
d2 = d.minusDays(-300);
System.out.println(d2);
}
}
Output
2016-02-16T17:10:45
2017-10-08T17:10:45