Noda Time
DateTimeZone Class
NamespacesNodaTimeDateTimeZone
Represents a time zone - a mapping between UTC and local time. A time zone maps UTC instants to local times - or, equivalently, to the offset from UTC at any particular instant.
Declaration Syntax
C#Visual BasicVisual C++
public abstract class DateTimeZone : IEquatable<DateTimeZone>
Public MustInherit Class DateTimeZone _
	Implements IEquatable(Of DateTimeZone)
public ref class DateTimeZone abstract : IEquatable<DateTimeZone^>
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
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.

Finalize()()()()
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
ForOffset(Offset)
Returns a fixed time zone with the given offset.

GetHashCode()()()()
Returns a hash code for this instance.
(Overrides Object.GetHashCode()()()().)
GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
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.

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.

MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
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 DateTimeZoneProviders.Default["UTC"]; that depends on whether the default provider has its own mapping for that ID.

Remarks

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:

Noda Time has two built-in sources of time zone data available: a copy of the "zoneinfo" (aka tz 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 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 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.

Thread Safety
All time zone implementations within Noda Time are immutable and thread-safe. See the thread safety section of the user guide for more information.
Inheritance Hierarchy

Assembly: NodaTime (Module: NodaTime) Version: 1.0.0.0 (1.0.1)