- java.time 程序包类
- java.time - 主页
- java.time - 时钟
- java.time - 持续时间
- java.time - 时间点
- java.time - 日期
- java.time - 日期时间
- java.time - 时间
- java.time - 月份
- java.time - 日期时间偏移量
- java.time - 时间偏移量
- java.time - 周期
- java.time - 年份
- java.time - 年月
- java.time - 时区日期时间
- java.time - 时区标识
- java.time - 时区偏移量
- java.time 程序包枚举
- java.time - 月份
- java.time 有用资源
- java.time - 讨论
java.time.OffsetTime.now() 方法示例
说明
java.time.OffsetTime.now(ZoneId zone) 方法从系统时钟获取指定时区中的当前时间。
声明
以下是 java.time.OffsetTime.now(ZoneId zone) 方法的声明。
public static OffsetTime now(ZoneId zone)
public static OffsetTime now(ZoneId zone)
参数
zone − 要使用的时区标识,非空。
返回值
使用系统时钟获取的当前时间,非空。
示例
package com.tutorialspoint;
import java.time.OffsetTime;
import java.time.ZoneId;
public class OffsetTimeDemo {
public static void main(String[] args) {
OffsetTime time = OffsetTime.now(ZoneId.systemDefault());
System.out.println(time);
}
}
实时演示
11:00:59.513+05:30
打印页面