ZoneRules.GetTransition(LocalDateTime) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the offset transition applicable at the specified local date-time in these rules.
[Android.Runtime.Register("getTransition", "(Ljava/time/LocalDateTime;)Ljava/time/zone/ZoneOffsetTransition;", "", ApiSince=26)]
public Java.Time.Zone.ZoneOffsetTransition? GetTransition(Java.Time.LocalDateTime? localDateTime);
[<Android.Runtime.Register("getTransition", "(Ljava/time/LocalDateTime;)Ljava/time/zone/ZoneOffsetTransition;", "", ApiSince=26)>]
member this.GetTransition : Java.Time.LocalDateTime -> Java.Time.Zone.ZoneOffsetTransition
Parameters
- localDateTime
- LocalDateTime
The local date-time to query for an offset transition. Fixed-offset rules may ignore null; variable rules do not.
Returns
The transition for a gap or overlap; otherwise, null.
- Attributes
Exceptions
Thrown if localDateTime is null and the rules are not fixed-offset.
Remarks
Gets the offset transition applicable at the specified local date-time in these rules. The mapping from a local date-time to an offset is not straightforward. There are three cases: Normal, with one valid offset. For the vast majority of the year, the normal case applies, where there is a single valid offset for the local date-time; Gap, with zero valid offsets. This is when clocks jump forward typically due to the spring daylight savings change from "winter" to "summer". In a gap there are local date-time values with no valid offset; Overlap, with two valid offsets. This is when clocks are set back typically due to the autumn daylight savings change from "summer" to "winter". In an overlap there are local date-time values with two valid offsets. A transition is used to model the cases of a Gap or Overlap. The Normal case will return null. There are various ways to handle the conversion from a LocalDateTime.
ZoneOffsetTransition trans = rules.getTransition(localDT);
if (trans != null) {
// Gap or Overlap: determine what to do from transition
} else {
// Normal case: only one valid offset
zoneOffset = rules.getOffset(localDT);
}
Java reference for java.time.zone.ZoneRules.getTransition.