语言

ZonedDateTime.WithZoneSameLocal(ZoneId) 方法

定义

返回具有不同时区的此日期时间的副本,并尽可能保留本地日期时间。

[Android.Runtime.Register("withZoneSameLocal", "(Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)]
public Java.Time.ZonedDateTime? WithZoneSameLocal(Java.Time.ZoneId? zone);
[<Android.Runtime.Register("withZoneSameLocal", "(Ljava/time/ZoneId;)Ljava/time/ZonedDateTime;", "", ApiSince=26)>]
member this.WithZoneSameLocal : Java.Time.ZoneId -> Java.Time.ZonedDateTime

参数

zone
ZoneId

要更改为的时区,而不是 null

返回

基于此日期时间的 ZonedDateTime,请求的区域,而不是 null

特性

注解

返回具有不同时区的此日期时间的副本,并尽可能保留本地日期时间。 此方法更改时区并保留本地日期时间。 仅当新区域无效时,本地日期时间才会更改,使用与 LocalDateTime、ZoneId、ZoneOffset 相同的方法确定。 若要更改区域并调整本地日期时间,请使用ZoneSameInstant(ZoneId)。 此实例不可变,不受此方法调用影响。

Java参考java.time.ZonedDateTime.withZoneSameLocal。

适用于