
- java.time 包中的類
- java.time - 首頁
- java.time - Clock
- java.time - Duration
- java.time - Instant
- java.time - LocalDate
- java.time - LocalDateTime
- java.time - LocalTime
- java.time - MonthDay
- java.time - OffsetDateTime
- java.time - OffsetTime
- java.time - Period
- java.time - Year
- java.time - YearMonth
- java.time - ZonedDateTime
- java.time - ZoneId
- java.time - ZoneOffset
- java.time 包中的列舉
- java.time - Month
- java.time 有用資源
- java.time - 討論
java.time.ZoneId 類
介紹
java.time.ZoneId 類表示時區 ID,例如 Europe/Paris。
類宣告
以下是java.time.ZoneId 類的宣告:
public abstract class ZoneId extends Object implements Serializable
欄位
以下是java.time.ZoneId 類的欄位:
static Map<String,String> SHORT_IDS − 一個區域覆蓋的對映,允許使用簡短的時區名稱。
類方法
序號 | 方法和描述 |
---|---|
1 | boolean equals(Object obj)
檢查此時區 ID 是否等於另一個時區 ID。 |
2 | static ZoneId from(TemporalAccessor temporal)
從時間物件獲取 ZoneId 例項。 |
3 | static Set<String> getAvailableZoneIds()
獲取可用時區 ID 的集合。 |
4 | String getDisplayName(TextStyle style, Locale locale)
獲取時區的文字表示形式,例如“英國時間”或“+02:00”。 |
5 | abstract String getId()
獲取唯一的時區 ID。 |
6 | abstract ZoneRules getRules()
獲取此 ID 的時區規則,允許執行計算。 |
7 | int hashCode()
此時區 ID 的雜湊碼。 |
8 | ZoneId normalized()
規範化時區 ID,儘可能返回 ZoneOffset。 |
9 | static ZoneId of(String zoneId)
從 ID 獲取 ZoneId 例項,確保 ID 有效且可用。 |
10 | static ZoneId of(String zoneId, Map<String,String> aliasMap)
使用其 ID 和別名對映獲取 ZoneId 例項,以補充標準時區 ID。 |
11 | static ZoneId ofOffset(String prefix, ZoneOffset offset)
獲取包裝偏移量的 ZoneId 例項。 |
12 | static ZoneId systemDefault()
獲取系統預設時區。 |
13 | String toString()
使用 ID 將此時區輸出為字串。 |
繼承的方法
此類繼承自以下類的方法:
- java.lang.Object
廣告