LocalDateTime plusMonths(long months) example
Description
LocalDateTime plusMonths(long months)
returns a copy of
this LocalDateTime with the specified period in months added.
Syntax
plusMonths
has the following syntax.
public LocalDateTime plusMonths(long months)
Example
The following example shows how to use plusMonths
.
import java.time.LocalDateTime;
//w w w. ja v a2s .c o m
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00);
LocalDateTime t = a.plusMonths(100);
System.out.println(t);
}
}
The code above generates the following result.