Example usage for java.time Duration plus

List of usage examples for java.time Duration plus

Introduction

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

Prototype

private Duration plus(long secondsToAdd, long nanosToAdd) 

Source Link

Document

Returns a copy of this duration with the specified duration added.

Usage

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    System.out.println(duration.getSeconds());
    duration = duration.plus(4, ChronoUnit.DAYS);
    System.out.println(duration.getSeconds());

}