Interface IDateTimeZoneProvider
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public interface IDateTimeZoneProvider
Remarks
Properties
Ids
Declaration
ReadOnlyCollection<string> Ids { get; }
Property Value
Type | Description |
---|---|
ReadOnlyCollection<String> | The IEnumerable<T> of string ids. |
Remarks
This list will be sorted in ordinal lexicographic order. It cannot be modified by callers, and must not be modified by the provider either: client code can safely treat it as thread-safe and deeply immutable.
In addition to the list returned here, providers always support the fixed-offset timezones with IDs "UTC" and "UTC+/-Offset". These may or may not be included explicitly in this list.
Item[String]
Declaration
DateTimeZone this[string id] { get; }
Parameters
Type | Name | Description |
---|---|---|
String | id | The time zone id to find. |
Property Value
Type | Description |
---|---|
DateTimeZone | The DateTimeZone for the given ID. |
Remarks
Unlike GetZoneOrNull(String), this indexer will never return a null reference. If the ID is not supported by this provider, it will throw TimeZoneNotFoundException.
Note that this may return a DateTimeZone that has a different ID to that requested, if the ID provided is an alias.
Note also that this method is not required to return the same DateTimeZone instance for successive requests for the same ID; however, all instances returned for a given ID must compare as equal.
The fixed-offset timezones with IDs "UTC" and "UTC+/-Offset" are always available. These must return instances that are equal to those returned by ForOffset(Offset).
Exceptions
Type | Condition |
---|---|
TimeZoneNotFoundException | This provider does not support the given ID. |
ArgumentNullException | id is null. |
VersionId
Declaration
string VersionId { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
Methods
GetSystemDefault()
Declaration
DateTimeZone GetSystemDefault()
Returns
Type | Description |
---|---|
DateTimeZone | The provider-specific representation of the system default time zone. |
Remarks
Exceptions
Type | Condition |
---|---|
TimeZoneNotFoundException | The system default time zone is not mapped by this provider. |
GetZoneOrNull(String)
Declaration
DateTimeZone GetZoneOrNull(string id)
Parameters
Type | Name | Description |
---|---|---|
String | id | The time zone ID to find. |
Returns
Type | Description |
---|---|
DateTimeZone | The DateTimeZone for the given ID or null if the provider does not support the given ID. |
Remarks
Note that this may return a DateTimeZone that has a different ID to that requested, if the ID provided is an alias.
Note also that this method is not required to return the same DateTimeZone instance for successive requests for the same ID; however, all instances returned for a given ID must compare as equal.
The fixed-offset timezones with IDs "UTC" and "UTC+/-Offset" are always available. These must return instances that are equal to those returned by ForOffset(Offset).
Exceptions
Type | Condition |
---|---|
ArgumentNullException | id is null. |