LocalDateTime minusMonths(long months) example
Description
LocalDateTime minusMonths(long months)
returns a copy of this
LocalDateTime with the specified period in months subtracted.
Syntax
minusMonths
has the following syntax.
public LocalDateTime minusMonths(long months)
Example
The following example shows how to use minusMonths
.
import java.time.LocalDateTime;
/*from ww w. j a v a 2 s .com*/
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00);
LocalDateTime t = a.minusMonths(10);
System.out.println(t);
}
}
The code above generates the following result.