Returns a copy of this LocalDateTime with the specified number of months subtracted, adjusting other fields if necessary.
package com.logicbig.example.localdatetime;
import java.time.LocalDateTime;
public class MinusMonthsExample {
public static void main (String... args) {
LocalDateTime d = LocalDateTime.of(2016, 11, 12,
12, 30, 15);
LocalDateTime d2 = d.minusMonths(200);
System.out.println(d2);
d2 = d.minusMonths(-200);
System.out.println(d2);
}
}
Output
2000-03-12T12:30:15
2033-07-12T12:30:15