ZonedDateTime minus(TemporalAmount amountToSubtract) example
Description
ZonedDateTime minus(TemporalAmount amountToSubtract)
returns a copy of this date-time with the specified amount subtracted.
Syntax
minus
has the following syntax.
public ZonedDateTime minus(TemporalAmount amountToSubtract)
Example
The following example shows how to use minus
.
import java.time.Period;
import java.time.ZonedDateTime;
/* www . j a v a2 s . c o m*/
public class Main {
public static void main(String[] args) {
ZonedDateTime dateTime = ZonedDateTime.now();
ZonedDateTime n = dateTime.minus(Period.ofDays(12));
System.out.println(n);
}
}
The code above generates the following result.