Example usage for java.time Duration withNanos

List of usage examples for java.time Duration withNanos

Introduction

In this page you can find the example usage for java.time Duration withNanos.

Prototype

public Duration withNanos(int nanoOfSecond) 

Source Link

Document

Returns a copy of this duration with the specified nano-of-second.

Usage

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    duration = duration.withNanos(1000);
    System.out.println(duration.getNano());

}