Example usage for java.time Duration withSeconds

List of usage examples for java.time Duration withSeconds

Introduction

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

Prototype

public Duration withSeconds(long seconds) 

Source Link

Document

Returns a copy of this duration with the specified amount of seconds.

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.withSeconds(1000);
    System.out.println(duration.getSeconds());
}