Duration ofMillis(long millis)
creates a Duration representing
a number of milliseconds.
The seconds and nanoseconds are extracted from the specified milliseconds.
ofMillis
has the following syntax.
public static Duration ofMillis(long millis)
The following example shows how to use ofMillis
.
import java.time.Duration; 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.