Class SkippedTimeException
Exception thrown to indicate that the specified local time doesn't
exist in a particular time zone due to daylight saving time changes.
Since 1.0.x
Availability net6.0, net8.0, netstandard2.0
Inheritance
SkippedTimeException
Implements
Inherited Members
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public sealed class SkippedTimeException : ArgumentOutOfRangeException, ISerializable
Remarks
This normally occurs for spring transitions, where the clock goes forward (usually by an hour). For example, suppose the time zone goes forward at 2am, so the second after 01:59:59 becomes 03:00:00. In that case, local times such as 02:30:00 never occur.
This exception is used to indicate such problems, as they're usually not the same as other ArgumentOutOfRangeException causes, such as entering "15" for a month number.
Note that it is possible (though extremely rare) for a whole day to be skipped due to a time zone transition, so this exception may also be thrown in cases where no local time is valid for a particular local date. (For example, Samoa skipped December 30th 2011 entirely, transitioning from UTC-10 to UTC+14 at midnight.)
Constructors
SkippedTimeException(LocalDateTime, DateTimeZone)
Creates a new instance for the given local date/time and time zone.
Since 1.0.x
Availability net6.0, net8.0, netstandard2.0
Declaration
public SkippedTimeException(LocalDateTime localDateTime, DateTimeZone zone)
Parameters
Type | Name | Description |
---|---|---|
LocalDateTime | localDateTime | The local date/time which is skipped in the specified time zone. |
DateTimeZone | zone | The time zone in which the local date/time does not exist. |
Remarks
User code is unlikely to need to deliberately call this constructor except
possibly for testing.
Properties
LocalDateTime
Gets the local date/time which is invalid in the time zone, prompting this exception.
Since 1.0.x
Availability net6.0, net8.0, netstandard2.0
Declaration
public LocalDateTime LocalDateTime { get; }
Property Value
Type | Description |
---|---|
LocalDateTime | The local date/time which is invalid in the time zone. |
Zone
Gets the time zone in which the local date/time is invalid.
Since 1.0.x
Availability net6.0, net8.0, netstandard2.0
Declaration
public DateTimeZone Zone { get; }
Property Value
Type | Description |
---|---|
DateTimeZone | The time zone in which the local date/time is invalid |