LocalDateTime plusMonths(long months)
returns a copy of
this LocalDateTime with the specified period in months added.
plusMonths
has the following syntax.
public LocalDateTime plusMonths(long months)
The following example shows how to use plusMonths
.
import java.time.LocalDateTime; /* w ww. j a v a 2s . 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.