1 /// <summary> 2 /// 角度转化度分秒 3 /// 秒取整 4 /// </summary> 5 /// <param name="angle"></param> 6 /// <returns></returns> 7 private string AngleConversion(decimal angle) 8 { 9 var d = Convert.ToInt32(angle.ToString().Split('.')[0]); 10 var ms = ((angle - d) * 60).ToString().Split('.'); 11 var m = Convert.ToInt32(ms[0]); 12 var s = ms.Length > 1 ? Convert.ToDecimal("0." + ms[1]) * 60 : 0; 13 var format = $"{d}°{m}'{s.ToString("0.#")}\""; 14 return format; 15 }
12.2436°=12°+0.2436x60’=12°+14.616’=12°14‘+0.616x60”=12°14‘+36.96“=12°20'36.96“
标签:分秒,12,angle,C#,Convert,转化,ms,var From: https://www.cnblogs.com/weilphome/p/17996022