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 net35-Client
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
Returns the number of results within this mapping: the number of distinct
ZonedDateTime values which map to the original LocalDateTime.
Since 1.0.x
Availability net35-Client
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
EarlyInterval
Returns the earlier ZoneInterval within this mapping. 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.
Since 1.0.x
Availability net35-Client
Declaration
public ZoneInterval EarlyInterval { get; }
Property Value
Type | Description |
---|---|
ZoneInterval |
LateInterval
Returns the later ZoneInterval within this mapping. 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.
Since 1.0.x
Availability net35-Client
Declaration
public ZoneInterval LateInterval { get; }
Property Value
Type | Description |
---|---|
ZoneInterval |
LocalDateTime
Returns the LocalDateTime which was mapped with in the time zone.
Since 1.0.x
Availability net35-Client
Declaration
public LocalDateTime LocalDateTime { get; }
Property Value
Type | Description |
---|---|
LocalDateTime |
Zone
Returns the DateTimeZone in which this mapping was performed.
Since 1.0.x
Availability net35-Client
Declaration
public DateTimeZone Zone { get; }
Property Value
Type | Description |
---|---|
DateTimeZone |
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 net35-Client
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 net35-Client
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 net35-Client
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. |