DateTime dateTime1 = Convert.ToDateTime("2020-05-05 01:29:29"); DateTime dateTime2 = Convert.ToDateTime("2020-05-06 12:25:25"); TimeSpan timeSpan = dateTime2 dateTime1;
这样可以得到相差的天数、小时数、分钟数和秒数。DateTime dateTime1 = Convert.ToDateTime("2020-05-05 01:29:29"); DateTime dateTime2 = Convert.ToDateTime("2020-05-06 12:25:25"); TimeSpan timeSpan = dateTime2 dateTime1;
这样可以得到相差的天数、小时数、分钟数和秒数。Powered By Z-BlogPHP 1.7.3