OffsetTime toOffsetTime()
描述 (Description)
java.time.OffsetDateTime.toOffsetTime()方法获取OffsetTime。
声明 (Declaration)
以下是java.time.OffsetDateTime.toOffsetTime()方法的声明。
public OffsetTime toOffsetTime()
返回值 (Return Value)
表示时间和偏移量的OffsetTime,不为null。
例子 (Example)
以下示例显示了java.time.OffsetDateTime.toOffsetTime()方法的用法。
package com.iowiki;
import java.time.OffsetDateTime;
public class OffsetDateTimeDemo {
public static void main(String[] args) {
OffsetDateTime date = OffsetDateTime.now();
System.out.println(date.toOffsetTime());
}
}
让我们编译并运行上面的程序,这将产生以下结果 -
14:19:10.353+05:30