简介
java.time.ZoneOffset 类表示格林威治/UTC的时区偏移量,例如+02:00.
类声明
以下是 java.time.ZoneOffset class :
public final class ZoneOffset extends ZoneId implements TemporalAccessor, TemporalAdjuster, Comparable, Serializable
字段
以下是Java.time.ZoneOffset类的字段:
static ZoneOffset MAX : 最大支持偏移量的常量.
static ZoneOffset MIN : 最小支持偏移量的常量.
static ZoneOffset UTC: UTC的时区偏移量,ID为"Z"。
类方法
Sr.No. | Method & Description |
---|---|
1 | Temporal adjustInto(Temporal temporal) Adjusts the specified temporal object to have the same offset as this object. |
2 | int compareTo(ZoneOffset other) Compares this offset to another offset in descending order. |
3 | boolean equals(Object obj) Checks if this offset is equal to another offset. |
4 | static ZoneOffset from(TemporalAccessor temporal) Obtains an instance of ZoneOffset from a temporal object. |
5 | int get(TemporalField field) Gets the value of the specified field from this offset as an int. |
6 | String getId() Gets the normalized zone offset ID. |
7 | long getLong(TemporalField field) Gets the value of the specified field from this offset as a long. |
8 | ZoneRules getRules() Gets the associated time-zone rules. |
9 | int getTotalSeconds() Gets the total zone offset in seconds. |
10 | int hashCode() A hash code for this offset. |
11 | boolean isSupported(TemporalField field) Checks if the specified field is supported. |
12 | static ZoneOffset of(String offsetId) Obtains an instance of ZoneOffset using the ID. |
13 | static ZoneOffset ofHours(int hours) Obtains an instance of ZoneOffset using an offset in hours. |
14 | static ZoneOffset ofHoursMinutes(int hours, int minutes) Obtains an instance of ZoneOffset using an offset in hours and minutes. |
15 | static ZoneOffset ofHoursMinutesSeconds(int hours, int minutes, int seconds) Obtains an instance of ZoneOffset using an offset in hours, minutes and seconds. |
16 | static ZoneOffset ofTotalSeconds(int totalSeconds) Obtains an instance of ZoneOffset specifying the total offset in seconds. |
17 | Queries this offset using the specified query. |
18 | ValueRange range(TemporalField field) Gets the range of valid values for the specified field. |
19 | String toString() Outputs this offset as a String, using the normalized ID. |
Methods inherited
This class inherits methods from the following classes −
Java.time.ZoneId
Java.lang.Object