Java Date Time - Instant plusMillis(long millisToAdd) example








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;
/*from   w  w w  .  ja  v  a  2  s  . co m*/
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.