[This is preliminary documentation and is subject to change.]

C# | Visual Basic | Visual C++ |
public abstract class DateTimeZone : IEquatable<DateTimeZone>, IZoneIntervalMap
Public MustInherit Class DateTimeZone _ Implements IEquatable(Of DateTimeZone), IZoneIntervalMap
public ref class DateTimeZone abstract : IEquatable<DateTimeZone^>, IZoneIntervalMap

All Members | Constructors | Methods | Properties | ||
Icon | Member | Description |
---|---|---|
![]() | DateTimeZone(String, Boolean, Offset, Offset) |
Initializes a new instance of the DateTimeZone class.
|
![]() | AtLeniently(LocalDateTime) |
Maps the given LocalDateTime to the corresponding ZonedDateTime in a lenient
manner: ambiguous values map to the later of the alternatives, and "skipped" values map to the start of the
zone interval after the "gap".
|
![]() | AtStartOfDay(LocalDate) |
Returns the earliest valid ZonedDateTime with the given local date.
|
![]() | AtStrictly(LocalDateTime) |
Maps the given LocalDateTime to the corresponding ZonedDateTime, if and only if
that mapping is unambiguous in this time zone. Otherwise, SkippedTimeException or
AmbiguousTimeException is thrown, depending on whether the mapping is ambiguous or the local
date/time is skipped entirely.
|
![]() | Equals(Object) |
Determines whether the specified Object is equal to this instance.
(Overrides Object.Equals(Object).) |
![]() | Equals(DateTimeZone) |
Determines whether the specified DateTimeZone is equal to this instance.
|
![]() | EqualsImpl(DateTimeZone) |
Implements equality in derived classes.
|
![]() ![]() | ForOffset(Offset) |
Returns a fixed time zone with the given offset.
|
![]() | GetHashCode()()()() |
Returns a hash code for this instance.
(Overrides Object.GetHashCode()()()().) |
![]() | GetUtcOffset(Instant) |
Returns the offset from UTC, where a positive duration indicates that local time is
later than UTC. In other words, local time = UTC + offset.
|
![]() | GetZoneInterval(Instant) |
Gets the zone interval for the given instant; the range of time around the instant in which the same Offset
applies (with the same split between standard time and daylight saving time, and with the same offset).
|
![]() | GetZoneIntervals(Instant, Instant) |
Returns all the zone intervals which occur for any instant in the interval [start, end).
|
![]() | GetZoneIntervals(Interval) |
Returns all the zone intervals which occur for any instant in the given interval.
|
![]() | Id |
The provider's ID for the time zone.
|
![]() | MapLocal(LocalDateTime) |
Returns complete information about how the given LocalDateTime is mapped in this time zone.
|
![]() | MaxOffset |
Returns the greatest (most positive) offset within this time zone, over all time.
|
![]() | MinOffset |
Returns the least (most negative) offset within this time zone, over all time.
|
![]() | ResolveLocal(LocalDateTime, ZoneLocalMappingResolver) |
Maps the given LocalDateTime to the corresponding ZonedDateTime, following
the given ZoneLocalMappingResolver to handle ambiguity and skipped times.
|
![]() | ToString()()()() |
Returns the ID of this time zone.
(Overrides Object.ToString()()()().) |
![]() ![]() | Utc |
Gets the UTC (Coordinated Universal Time) time zone. This is a single instance which is not
provider-specific; it is guaranteed to have the ID "UTC", but may or may not be the instance returned by
e.g. DateTimeZoneProviders.Tzdb["UTC"].
|

The mapping is unambiguous in the "UTC to local" direction, but the reverse is not true: when the offset changes, usually due to a Daylight Saving transition, the change either creates a gap (a period of local time which never occurs in the time zone) or an ambiguity (a period of local time which occurs twice in the time zone). Mapping back from local time to an instant requires consideration of how these problematic times will be handled.
Noda Time provides various options when mapping local time to a specific instant:
- AtStrictly(LocalDateTime) will throw an exception if the mapping from local time is either ambiguous or impossible, i.e. if there is anything other than one instant which maps to the given local time.
- AtLeniently(LocalDateTime) will never throw an exception due to ambiguous or skipped times, resolving to the later option of ambiguous matches or the start of the zone interval after the gap for skipped times.
- ResolveLocal(LocalDateTime, ZoneLocalMappingResolver) will apply a ZoneLocalMappingResolver to the result of a mapping.
- MapLocal(LocalDateTime) will return a ZoneLocalMapping with complete information about whether the given local time occurs zero times, once or twice. This is the most fine-grained approach, which is the fiddliest to use but puts the caller in the most control.
Noda Time has two built-in sources of time zone data available: a copy of the tz database (also known as the IANA Time Zone database, or zoneinfo or Olson database), and the ability to convert .NET's own TimeZoneInfo format into a "native" Noda Time zone. Which of these is most appropriate for you to use will very much depend on your exact needs. The zoneinfo database is widely used outside Windows, and has more historical data than the Windows-provided information, but if you need to interoperate with other Windows systems by specifying time zone IDs, you may wish to stick to the Windows time zones.
To obtain a DateTimeZone for a given timezone ID, use one of the methods on IDateTimeZoneProvider (and see DateTimeZoneProviders for access to the built-in providers). The UTC timezone is also available via the Utc property on this class.
To obtain a DateTimeZone representing the system default time zone, you can either call GetSystemDefault()()()() on a provider to obtain the DateTimeZone that the provider considers matches the system default time zone, or you can construct a BclDateTimeZone via BclDateTimeZone.ForSystemDefault, which returns a DateTimeZone that wraps the system local TimeZoneInfo. The latter will always succeed, but has access only to that information available via the .NET time zone; the former may contain more complete data, but may (in uncommon cases) fail to find a matching DateTimeZone. Note that BclDateTimeZone is not available on the PCL build of Noda Time, so this fallback strategy can only be used with the desktop version.
Note that Noda Time does not require that DateTimeZone instances be singletons. As far as reasonably possible, implementations should implement IEquatable<(Of <(<'T>)>)> in such a way that equivalent time zones compare as equal.


Assembly: NodaTime (Module: NodaTime.dll) Version: 1.2.0.0 (1.2.0)