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 net6.0, net8.0, netstandard2.0
Inherited Members
Namespace: NodaTime.TimeZones
Assembly: NodaTime.dll
Syntax
public sealed class TzdbZoneLocation
Constructors
TzdbZoneLocation(int, int, string, string, string, string)
Creates a new location.
Since 1.1.x
Availability net6.0, net8.0, netstandard2.0
Declaration
public TzdbZoneLocation(int latitudeSeconds, int longitudeSeconds, string countryName, string countryCode, string zoneId, string comment)
Parameters
Type | Name | Description |
---|---|---|
int | latitudeSeconds | Latitude of the location, in seconds. |
int | 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. |
Properties
Comment
Gets the comment (in English) for the mapping, if any.
Since 1.1.x
Availability net6.0, net8.0, netstandard2.0
Declaration
public string Comment { get; }
Property Value
Type | Description |
---|---|
string | The comment (in English) for the mapping, if any. |
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 net6.0, net8.0, 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. |
CountryName
Gets the English name of the country containing the location, which is never empty.
Since 1.1.x
Availability net6.0, net8.0, netstandard2.0
Declaration
public string CountryName { get; }
Property Value
Type | Description |
---|---|
string | The English name of the country containing the location. |
Latitude
Gets the latitude in degrees; positive for North, negative for South.
Since 1.1.x
Availability net6.0, net8.0, 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 net6.0, net8.0, 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 net6.0, net8.0, netstandard2.0
Declaration
public string ZoneId { get; }
Property Value
Type | Description |
---|---|
string | The ID of the time zone for this location. |
Remarks
If this mapping was fetched from a TzdbDateTimeZoneSource, it will always be a valid ID within that source.