label1.Text = "2004-1-1 15:36:05"; label2.Text = "2004-3-1 20:16:35"; DateTime d1 =new DateTime(2004,1,1,15,36,05); DateTime d2 =new DateTime(2004,3,1,20,16,35); TimeSpan d3 = d2.Subtract(d1); label3.Text = "相差:" +d3.Days.ToString()+"天" +d3.Hours.ToString()+"小时" +d3.Minutes.ToString()+"分钟" +d3.Seconds.ToString()+"秒";
C# 计算时间差
最新推荐文章于 2024-06-04 17:13:58 发布