OffsetDateTime minusMonths(long months) example
Description
OffsetDateTime minusMonths(long months)
returns a copy of this OffsetDateTime with the specified period in months subtracted.
Syntax
minusMonths
has the following syntax.
public OffsetDateTime minusMonths(long months)
Example
The following example shows how to use minusMonths
.
import java.time.OffsetDateTime;
/*w w w. ja v a 2 s. c o m*/
public class Main {
public static void main(String[] args) {
OffsetDateTime o = OffsetDateTime.now();
OffsetDateTime d = o.minusMonths(120);
System.out.println(d);
}
}
The code above generates the following result.