Table of Contents

Struct ZonedDateTime

Namespace
Hegel.Temporal
Assembly
Hegel.dll

A date and time in a time zone, as ZonedDateTimes() draws it: the wall-clock time, the zone, and what the generator's ZoneSource says that wall clock means there. .NET has no such type of its own: a DateTimeOffset keeps the offset but not the zone, and cannot say that a wall-clock time was skipped or repeated.

public readonly record struct ZonedDateTime : IEquatable<ZonedDateTime>
Implements
Inherited Members

Constructors

ZonedDateTime(DateTime, TimeSpan, TimeZoneInfo, DateTimeOffset, WallTimeKind)

A zoned date-time from its parts, which are taken as given: nothing checks them against zone.

public ZonedDateTime(DateTime localDateTime, TimeSpan offset, TimeZoneInfo zone, DateTimeOffset instant, WallTimeKind kind)

Parameters

localDateTime DateTime

The wall-clock time; its Kind is ignored.

offset TimeSpan

The UTC offset in force.

zone TimeZoneInfo

The time zone.

instant DateTimeOffset

The instant the wall-clock time means.

kind WallTimeKind

What the wall-clock time is in the zone.

Properties

Instant

The instant, in UTC: the one LocalDateTime names, the one Kind picks of the two a repeated time names, or for a skipped time the wall-clock time read with the offset in force before the clocks changed.

public DateTimeOffset Instant { get; }

Property Value

DateTimeOffset

Kind

Whether the wall clock showed LocalDateTime once, twice or never.

public WallTimeKind Kind { get; }

Property Value

WallTimeKind

LocalDateTime

The wall-clock time in Zone, of Unspecified.

public DateTime LocalDateTime { get; }

Property Value

DateTime

Offset

The UTC offset in force at Instant. It need not be a whole number of minutes: a zone's offset before standard time usually is not.

public TimeSpan Offset { get; }

Property Value

TimeSpan

Zone

The time zone.

public TimeZoneInfo Zone { get; }

Property Value

TimeZoneInfo

Methods

ToDateTimeOffset()

Instant at Offset, with the offset's seconds dropped because a DateTimeOffset holds whole minutes only.

public DateTimeOffset ToDateTimeOffset()

Returns

DateTimeOffset

Exceptions

ArgumentOutOfRangeException

The result lies outside the years 1 to 9999.

ToString()

The engine's text for the value, such as 2024-03-10T01:30:00-05:00[America/New_York].

public override string ToString()

Returns

string