Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 如何在度、分、秒之间转换为十进制坐标
我有39°07.356"N和121°02.482"W,我需要将其转换为十进制度。任何来源?
您可以使用以下函数来执行任务
public decimal DmsToDD(double d, double m = 0, double s = 0) { return Convert.ToDecimal((d + (m/60) + (s/3600))*(d < 0 ? -1 : 1)); }
当然,在进行转换之前,您需要检查以确保分钟和秒组件是非负数。