string t1 = "2019-1-1 00:00:00";
string t2 = "2019-1-2 18:00:00";
DateTime t11 = DateTime.Parse(t1);
DateTime t22 = DateTime.Parse(t2);
时间相差多少:
Double sp = t22.Subtract(t11).TotalDays; t22和t11相差天数结果:1.75天
时间加上多少:
DateTime t = t11.AddSeconds(86400); 加上86400秒,结果:2019-1-2 00:00:00