DateTime time1 =new DateTime(1982,4,24,14,23,06);
DateTime time2 =new DateTime(1982,1,21,8,16,32);
TimeSpan ts= time2.Subtract(time1);
string timespan = "相差:"
+ts.Days.ToString()+"天"
+ts.Hours.ToString()+"小时"
+ts.Minutes.ToString()+"分钟"
+ts.Seconds.ToString()+"秒";
C#中计算两个日期差
最新推荐文章于 2023-12-09 08:16:09 发布