C#中计算两个时间间隔值
作者:互联网
C#中计算两个时间间隔值
// TimeSpan DateTime t1 = Convert.ToDateTime("2020/11/17 12:30:00"); DateTime t2 = Convert.ToDateTime("2020/11/17 12:40:00"); int tsm = t2.Subtract(t1).Duration().Milliseconds;//以毫秒计算 int ts = t2.Subtract(t1).Duration().Seconds;//以秒计算 int tm = t2.Subtract(t1).Duration().Minutes;//以分计算 int th = t2.Subtract(t1).Duration().Hours;//以时计算 int td = t2.Subtract(t1).Duration().Days;//以天计算
标签:C#,间隔,t2,t1,int,计算,Duration,Subtract 来源: https://www.cnblogs.com/wml-it/p/14777234.html