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