Duration plusDays(long daysToAdd) example
Description
Duration plusDays(long daysToAdd)
returns a copy of this
duration with the specified duration in standard 24 hour days added.
Syntax
plusDays
has the following syntax.
public Duration plusDays(long daysToAdd)
Example
The following example shows how to use plusDays
.
import java.time.Duration;
import java.time.LocalTime;
//from w ww . j ava 2s . c o m
public class Main {
public static void main(String[] args) {
Duration duration = Duration.between(LocalTime.MIDNIGHT,LocalTime.NOON);
System.out.println(duration.getSeconds());
duration = duration.plusDays(4);
System.out.println(duration.getSeconds());
}
}
The code above generates the following result.