Click or drag to resize

UtilDMSToDegrees Method

Convert sexagesimal degrees to binary double-precision degrees

Namespace:  ASCOM.Utilities
Assembly:  ASCOM.Utilities (in ASCOM.Utilities.dll) Version: (
public double DMSToDegrees(
	string DMS


Type: SystemString
The sexagesimal input string (degrees)

Return Value

Type: Double
The double-precision binary value (degrees) represented by the sexagesimal input

The sexagesimal to real conversion methods such as this one are flexible enough to convert just about anything that resembles sexagesimal. Thee way they operate is to first separate the input string into numeric "tokens", strings consisting only of the numerals 0-9, plus and minus, and period. All other characters are considered delimiters. Once the input string is parsed into tokens they are converted to numerics.

If there are more than three numeric tokens, only the first three are considered, the remainder are ignored. Left to right positionally, the tokens are assumed to represent units (degrees or hours), minutes, and seconds. If only two tokens are present, they are assumed to be units and minutes, and if only one token is present, it is assumed to be units. Any token can have a fractionsl part. Of course it would not be normal (for example) for both the minutes and seconds parts to have fractional parts, but it would be legal. So 00:30.5:30 would convert to 1.0 unit.

Note that plain units, for example 23.128734523 are acceptable to the method.

See Also