Example usage for java.time Instant with

List of usage examples for java.time Instant with

Introduction

In this page you can find the example usage for java.time Instant with.

Prototype

@Override
public Instant with(TemporalField field, long newValue) 

Source Link

Document

Returns a copy of this instant with the specified field set to a new value.

Usage

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
    instant = instant.with(ChronoField.MILLI_OF_SECOND, 20);
    System.out.println(instant);/*from w  ww .j a  v  a  2  s  .  co  m*/

}