📜  java.time.ZoneOffset类

📅  最后修改于: 2020-11-14 10:49:39             🧑  作者: Mango


介绍

java.time.ZoneOffset类表示与格林威治/ UTC的时区偏移量,例如+02:00。

类声明

以下是java.time.ZoneOffset类的声明-

public final class ZoneOffset
   extends ZoneId
      implements TemporalAccessor, TemporalAdjuster, Comparable, Serializable

领域

以下是Java.time.ZoneOffset类的字段-

  • 静态ZoneOffset MAX-常数,表示支持的最大偏移量。

  • static ZoneOffset MIN-最小支持偏移量的常数。

  • 静态ZoneOffset UTCUTC的时区偏移,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 R query(TemporalQuery query)

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.

方法继承

此类从以下类继承方法-

  • Java.time.ZoneId
  • Java.lang.Object