語言

OffsetTime.OfInstant(Instant, ZoneId) 方法

定義

從即時與區域 ID 取得 OffsetTime 實例。

[Android.Runtime.Register("ofInstant", "(Ljava/time/Instant;Ljava/time/ZoneId;)Ljava/time/OffsetTime;", "", ApiSince=26)]
public static Java.Time.OffsetTime? OfInstant(Java.Time.Instant? instant, Java.Time.ZoneId? zone);
[<Android.Runtime.Register("ofInstant", "(Ljava/time/Instant;Ljava/time/ZoneId;)Ljava/time/OffsetTime;", "", ApiSince=26)>]
static member OfInstant : Java.Time.Instant * Java.Time.ZoneId -> Java.Time.OffsetTime

參數

instant
Instant

創造時間的瞬間,而非虛無

zone
ZoneId

時區,可以是偏移,但不是零

傳回

偏移時間,而非零時間

屬性

備註

從即時與區域 ID 取得 OffsetTime 實例。 這會產生一個與指定時間相同的偏移時間。 從UTC/格林威治尋找偏移量很簡單,因為每個瞬間只有一個有效的偏移量。 瞬間的日期成分在轉換過程中會被省略。 這表示轉換永遠不會因為瞬間超出有效日期範圍而失敗。

Java 參考 java.time.OffsetTime.ofInstant。

適用於