Duration plusMillis(long millisToAdd) example
Description
Duration plusMillis(long millisToAdd)
returns a copy
of this duration with the specified duration in milliseconds added.
Syntax
plusMillis
has the following syntax.
public Duration plusMillis(long millisToAdd)
Example
The following example shows how to use plusMillis
.
import java.time.Duration;
import java.time.LocalTime;
/* w w w . j av a 2 s . 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.plusMillis(4000);
System.out.println(duration.getSeconds());
}
}
The code above generates the following result.