Class ZoneLocalMapping
The result of mapping a LocalDateTime within a time zone, i.e. finding out
at what "global" time the "local" time occurred.
Since 1.0.x
Availability net45, netstandard1.3
Inheritance
Object
ZoneLocalMapping
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime.TimeZones
Assembly: NodaTime.dll
Syntax
public sealed class ZoneLocalMapping
Remarks
This class is used as the return type of MapLocal(LocalDateTime). It allows for finely-grained handling of the three possible results:
- Unambiguous mappingThe local time occurs exactly once in the target time zone.
- Ambiguous mapping The local time occurs twice in the target time zone, due to the offset from UTC changing. This usually occurs for an autumnal daylight saving transition, where the clocks are put back by an hour. If the clocks change from 2am to 1am for example, then 1:30am occurs twice - once before the transition and once afterwards.
- Impossible mapping The local time does not occur at all in the target time zone, due to the offset from UTC changing. This usually occurs for a vernal (spring-time) daylight saving transition, where the clocks are put forward by an hour. If the clocks change from 1am to 2am for example, then 1:30am is skipped entirely.
Properties
Count
Gets the number of results within this mapping: the number of distinct
ZonedDateTime values which map to the original LocalDateTime.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of results within this mapping: the number of distinct values which map to the original local date and time. |
EarlyInterval
Gets the earlier ZoneInterval within this mapping.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public ZoneInterval EarlyInterval { get; }
Property Value
Type | Description |
---|---|
ZoneInterval | The earlier zone interval within this mapping. |
Remarks
For unambiguous mappings, this is the same as LateInterval; for ambiguous mappings,
this is the interval during which the mapped local time first occurs; for impossible
mappings, this is the interval before which the mapped local time occurs.
LateInterval
Gets the later ZoneInterval within this mapping.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public ZoneInterval LateInterval { get; }
Property Value
Type | Description |
---|---|
ZoneInterval | The later zone interval within this mapping. |
Remarks
For unambiguous
mappings, this is the same as EarlyInterval; for ambiguous mappings,
this is the interval during which the mapped local time last occurs; for impossible
mappings, this is the interval after which the mapped local time occurs.
LocalDateTime
Gets the LocalDateTime which was mapped within the time zone.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public LocalDateTime LocalDateTime { get; }
Property Value
Type | Description |
---|---|
LocalDateTime | The local date and time which was mapped within the time zone. |
Zone
Gets the DateTimeZone in which this mapping was performed.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public DateTimeZone Zone { get; }
Property Value
Type | Description |
---|---|
DateTimeZone | The time zone in which this mapping was performed. |
Methods
First()
Returns a ZonedDateTime which maps to the original LocalDateTime
in the mapped DateTimeZone: either the single result if the mapping is unambiguous,
or the earlier result if the local date/time occurs twice in the time zone due to a time zone
offset change such as an autumnal daylight saving transition.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public ZonedDateTime First()
Returns
Type | Description |
---|---|
ZonedDateTime | The unambiguous result of mapping a local date/time in a time zone. |
Exceptions
Type | Condition |
---|---|
SkippedTimeException | The local date/time was skipped in the time zone. |
Last()
Returns a ZonedDateTime which maps to the original LocalDateTime
in the mapped DateTimeZone: either the single result if the mapping is unambiguous,
or the later result if the local date/time occurs twice in the time zone due to a time zone
offset change such as an autumnal daylight saving transition.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public ZonedDateTime Last()
Returns
Type | Description |
---|---|
ZonedDateTime | The unambiguous result of mapping a local date/time in a time zone. |
Exceptions
Type | Condition |
---|---|
SkippedTimeException | The local date/time was skipped in the time zone. |
Single()
Returns the single ZonedDateTime which maps to the original
LocalDateTime in the mapped DateTimeZone.
Since 1.0.x
Availability net45, netstandard1.3
Declaration
public ZonedDateTime Single()
Returns
Type | Description |
---|---|
ZonedDateTime | The unambiguous result of mapping the local date/time in the time zone. |
Exceptions
Type | Condition |
---|---|
SkippedTimeException | The local date/time was skipped in the time zone. |
AmbiguousTimeException | The local date/time was ambiguous in the time zone. |