Noda Time
Show / Hide Table of Contents

Class AmbiguousTimeException

Exception thrown to indicate that the specified local date/time occurs twice in a particular time zone due to daylight saving time changes.
Since 1.0.x
Availability netstandard2.0
Inheritance
Object
Exception
SystemException
ArgumentException
ArgumentOutOfRangeException
AmbiguousTimeException
Implements
ISerializable
Inherited Members
ArgumentOutOfRangeException.GetObjectData(SerializationInfo, StreamingContext)
ArgumentOutOfRangeException.ActualValue
ArgumentOutOfRangeException.Message
ArgumentException.ParamName
Exception.GetBaseException()
Exception.GetType()
Exception.ToString()
Exception.Data
Exception.HelpLink
Exception.HResult
Exception.InnerException
Exception.Source
Exception.StackTrace
Exception.TargetSite
Exception.SerializeObjectState
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public sealed class AmbiguousTimeException : ArgumentOutOfRangeException, ISerializable
Remarks

This occurs for transitions where the clock goes backward (usually by an hour). For example, suppose the time zone goes backward at 2am, so the second after 01:59:59 becomes 01:00:00. In that case, times such as 01:30:00 occur twice.

This exception is used to indicate such problems, as they're usually not the same as other System.ArgumentOutOfRangeException causes, such as entering "15" for a month number.

In theory this isn't calendar-specific; the local value will be ambiguous in this time zone regardless of the calendar used. However, this exception is always created in conjunction with a specific calendar, which leads to a more natural way of examining its information and constructing an error message.

Constructors

AmbiguousTimeException(ZonedDateTime, ZonedDateTime)

Constructs an instance from the given information.
Since 1.0.x
Availability netstandard2.0
Declaration
public AmbiguousTimeException(ZonedDateTime earlierMapping, ZonedDateTime laterMapping)
Parameters
Type Name Description
ZonedDateTime earlierMapping The earlier possible mapping
ZonedDateTime laterMapping The later possible mapping
Remarks

User code is unlikely to need to deliberately call this constructor except possibly for testing.

The two mappings must have the same local time and time zone.

Properties

EarlierMapping

Gets the earlier of the two occurrences of the local date and time within the time zone.
Since 1.0.x
Availability netstandard2.0
Declaration
public ZonedDateTime EarlierMapping { get; }
Property Value
Type Description
ZonedDateTime The earlier of the two occurrences of the local date and time within the time zone.

LaterMapping

Gets the later of the two occurrences of the local date and time within the time zone.
Since 1.0.x
Availability netstandard2.0
Declaration
public ZonedDateTime LaterMapping { get; }
Property Value
Type Description
ZonedDateTime The later of the two occurrences of the local date and time within the time zone.

Zone

The time zone in which the local date and time is ambiguous.
Since 1.0.x
Availability netstandard2.0
Declaration
public DateTimeZone Zone { get; }
Property Value
Type Description
DateTimeZone The time zone in which the local date and time is ambiguous.

Implements

System.Runtime.Serialization.ISerializable
In this article
Back to top Generated by DocFX