ZoneOffset ofHours(int hours) example
Description
ZoneOffset ofHours(int hours)
creates an instance of ZoneOffset using an offset in hours.
Syntax
ofHours
has the following syntax.
public static ZoneOffset ofHours(int hours)
Example
The following example shows how to use ofHours
.
import java.time.ZoneOffset;
/*w w w . j a v a 2 s.co m*/
public class Main {
public static void main(String[] args) {
ZoneOffset t = ZoneOffset.ofHours(1);
System.out.println(t);
}
}
The code above generates the following result.