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