Duration ofMillis(long millis) example
Description
Duration ofMillis(long millis)
creates a Duration representing
a number of milliseconds.
The seconds and nanoseconds are extracted from the specified milliseconds.
Syntax
ofMillis
has the following syntax.
public static Duration ofMillis(long millis)
Example
The following example shows how to use ofMillis
.
import java.time.Duration;
/*from w ww . j ava 2 s . co m*/
public class Main {
public static void main(String[] args) {
Duration duration = Duration.ofMillis(10);
System.out.println(duration);
}
}
The code above generates the following result.