Duration ofHours(long hours) example
Description
Duration ofHours(long hours)
creates
a Duration representing a number of standard hours.
Syntax
ofHours
has the following syntax.
public static Duration ofHours(long hours)
Example
The following example shows how to use ofHours
.
import java.time.Duration;
/* w ww . j a v a 2 s . c om*/
public class Main {
public static void main(String[] args) {
Duration duration = Duration.ofHours(10);
System.out.println(duration);
}
}
The code above generates the following result.