C# 计算日期时间的间隔天数

1 DateTime oldDate = new DateTime(2002,7,15); 

2 DateTime newDate = DateTime.Now; 

3 // Difference in days, hours, and minutes. 

4 TimeSpan ts = newDate - oldDate; 

5 // Difference in days. 

6 int differenceInDays = ts.Days; 

 

你可能感兴趣的:(C#)