Class TimeZoneInfoExtensions
- Namespace
- LfrlAnvil.Chrono.Extensions
- Assembly
- LfrlAnvil.Chrono.dll
Contains TimeZoneInfo extension methods.
public static class TimeZoneInfoExtensions
- Inheritance
-
TimeZoneInfoExtensions
- Inherited Members
Methods
GetActiveAdjustmentRule(TimeZoneInfo, DateTime)
Attempts to find the first TimeZoneInfo.AdjustmentRule instance that applies to the given dateTime
.
[Pure]
public static TimeZoneInfo.AdjustmentRule? GetActiveAdjustmentRule(this TimeZoneInfo timeZone, DateTime dateTime)
Parameters
timeZone
TimeZoneInfoSource time zone.
dateTime
DateTimeTarget date time.
Returns
- TimeZoneInfo.AdjustmentRule
First TimeZoneInfo.AdjustmentRule instance that applies to the given
dateTime
or null when none exists.
GetActiveAdjustmentRuleIndex(TimeZoneInfo, DateTime)
Attempts to find the 0-based index of the first TimeZoneInfo.AdjustmentRule instance
that applies to the given dateTime
.
[Pure]
public static int GetActiveAdjustmentRuleIndex(this TimeZoneInfo timeZone, DateTime dateTime)
Parameters
timeZone
TimeZoneInfoSource time zone.
dateTime
DateTimeTarget date time.
Returns
- int
0-based index of the first TimeZoneInfo.AdjustmentRule instance that applies to the given
dateTime
or -1 when none exists.
GetContainingAmbiguityRange(TimeZoneInfo, DateTime)
Attempts to find a range of ambiguous DateTime instances defined by the provided timeZone
that contains the given dateTime
.
[Pure]
public static Bounds<DateTime>? GetContainingAmbiguityRange(this TimeZoneInfo timeZone, DateTime dateTime)
Parameters
timeZone
TimeZoneInfoSource time zone.
dateTime
DateTimeTarget date time.
Returns
- Bounds<DateTime>?
Range of ambiguous DateTime instances defined by the provided
timeZone
that contains the givendateTime
or null, whendateTime
is not ambiguous.
GetContainingInvalidityRange(TimeZoneInfo, DateTime)
Attempts to find a range of invalid DateTime instances defined by the provided timeZone
that contains the given dateTime
.
[Pure]
public static Bounds<DateTime>? GetContainingInvalidityRange(this TimeZoneInfo timeZone, DateTime dateTime)
Parameters
timeZone
TimeZoneInfoSource time zone.
dateTime
DateTimeTarget date time.
Returns
- Bounds<DateTime>?
Range of invalid DateTime instances defined by the provided
timeZone
that contains the givendateTime
or null, whendateTime
is valid.
GetDateTimeKind(TimeZoneInfo)
Gets DateTimeKind associated with the specified timeZone
.
[Pure]
public static DateTimeKind GetDateTimeKind(this TimeZoneInfo timeZone)
Parameters
timeZone
TimeZoneInfoSource time zone.
Returns
- DateTimeKind
DateTimeKind associated with the specified
timeZone
.