Java TimeZone getTimeZone() 方法

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

TimeZone 类的 getTimeZone(String ID) 方法用于获取给定 ID 的 TimeZone。

语法

参数

ID - TimeZone 的 ID。

返回值

它返回给定 ID 的 TimeZone

示例 1

输出

Time Zone:sun.util.calendar.ZoneInfo[id="Pacific/Palau",offset=32400000,dstSavings=0,useDaylight=false,transitions=3,
lastRule=null]

示例 2

输出

Time Zone:sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]