目录

static ZoneOffset of(String offsetId)

描述 (Description)

java.time.ZoneOffset.of(String offsetId)方法使用ID获取ZoneOffset的实例。

声明 (Declaration)

以下是java.time.ZoneOffset.of(String offsetId)方法的声明。

public static ZoneOffset of(String offsetId)

参数 (Parameters)

offsetId - 偏移ID,不为null。

返回值 (Return Value)

zone-offset,not null。

异常 (Exceptions)

DateTimeException - 如果偏移ID无效。

例子 (Example)

以下示例显示了java.time.ZoneOffset.of(String offsetId)方法的用法。

package com.iowiki;
import java.time.ZoneOffset;
public class ZoneOffsetDemo {
   public static void main(String[] args) {
      ZoneOffset zone = ZoneOffset.of("Z");
      System.out.println(zone);  
   }
}

让我们编译并运行上面的程序,这将产生以下结果 -

Z
↑回到顶部↑
WIKI教程 @2018