Instant minusSeconds(long secondsToSubtract) example
Description
Instant minusSeconds(long secondsToSubtract)
returns a
copy of this instant with the specified duration in seconds subtracted.
Syntax
minusSeconds
has the following syntax.
public Instant minusSeconds(long secondsToSubtract)
Example
The following example shows how to use minusSeconds
.
import java.time.Instant;
/*from w w w . j a v a 2s . c o m*/
public class Main {
public static void main(String[] args) {
Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
instant = instant.minusSeconds(10000);
System.out.println(instant);
}
}
The code above generates the following result.