Java Calendar getTimeZone() 方法

2024年11月3日 | 阅读 1 分钟

java.util.Calendar 类的 getTimeZone() 方法获取日历对象的时区,并返回一个 TimeZone 对象。

语法

参数

不传递任何参数。

返回值

返回 TimeZone 对象。

抛出

不抛出异常。

示例 1

输出

TimeZone:Pacific Standard Time
Time Zone after changing to GMT:Greenwich Mean Time

示例 2

输出

Display Name of Current TimeZone Pacific Standard Time