LocalDateTime minus(TemporalAmount amountToSubtract) example
Description
LocalDateTime minus(TemporalAmount amountToSubtract)
returns a copy of this date-time with the specified amount subtracted.
Syntax
minus
has the following syntax.
public LocalDateTime minus(TemporalAmount amountToSubtract)
Example
The following example shows how to use minus
.
import java.time.LocalDateTime;
import java.time.Period;
/*from ww w. ja v a2s.c om*/
public class Main {
public static void main(String[] args) {
LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00);
LocalDateTime t = a.minus(Period.ofDays(100));
System.out.println(t);
}
}
The code above generates the following result.