Class TzdbZoneLocation
A location entry generated from the "zone.tab" file in a TZDB release. This can be used to provide
users with a choice of time zone, although it is not internationalized.
Since 1.1.x
Availability net45, netstandard1.3, netstandard2.0
Inheritance
Object
TzdbZoneLocation
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime.TimeZones
Assembly: NodaTime.dll
Syntax
public sealed class TzdbZoneLocation
Constructors
TzdbZoneLocation(Int32, Int32, String, String, String, String)
Creates a new location.
Since 1.1.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public TzdbZoneLocation(int latitudeSeconds, int longitudeSeconds, string countryName, string countryCode, string zoneId, string comment)
Parameters
Type | Name | Description |
---|---|---|
Int32 | latitudeSeconds | Latitude of the location, in seconds. |
Int32 | longitudeSeconds | Longitude of the location, in seconds. |
String | countryName | English country name of the location, in degrees. Must not be null. |
String | countryCode | ISO-3166 country code of the location. Must not be null. |
String | zoneId | Time zone identifier of the location. Must not be null. |
String | comment | Optional comment. Must not be null, but may be empty. |
Remarks
This constructor is only public for the sake of testability. Non-test code should
usually obtain locations from a TzdbDateTimeZoneSource.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The latitude or longitude is invalid. |
ArgumentNullException | countryName, countryCode, zoneId or comment is null |
Properties
Comment
Gets the comment (in English) for the mapping, if any.
Since 1.1.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public string Comment { get; }
Property Value
Type | Description |
---|---|
String | The comment (in English) for the mapping, if any. (The value returned is never null.) |
Remarks
This is usually used to differentiate between locations in the same country.
This will return an empty string if no comment was provided in the original data.
CountryCode
Gets the ISO-3166 2-letter country code for the country containing the location.
Since 1.1.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public string CountryCode { get; }
Property Value
Type | Description |
---|---|
String | The ISO-3166 2-letter country code for the country containing the location. (The value returned is never null.) |
CountryName
Gets the English name of the country containing the location, which is never empty.
Since 1.1.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public string CountryName { get; }
Property Value
Type | Description |
---|---|
String | The English name of the country containing the location. (The value returned is never null.) |
Latitude
Gets the latitude in degrees; positive for North, negative for South.
Since 1.1.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public double Latitude { get; }
Property Value
Type | Description |
---|---|
Double | The latitude in degrees; positive for North, negative for South. |
Remarks
The value will be in the range [-90, 90].
Longitude
Gets the longitude in degrees; positive for East, negative for West.
Since 1.1.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public double Longitude { get; }
Property Value
Type | Description |
---|---|
Double | The longitude in degrees; positive for East, negative for West. |
Remarks
The value will be in the range [-180, 180].
ZoneId
The ID of the time zone for this location.
Since 1.1.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public string ZoneId { get; }
Property Value
Type | Description |
---|---|
String | The ID of the time zone for this location. (The value returned is never null.) |
Remarks
If this mapping was fetched from a TzdbDateTimeZoneSource, it will always be a valid ID within that source.