计算两个日期相隔的天数
1: /// <summary>
2: /// 计算两个日期相隔的天数
3: /// </summary>
4: /// <param name="startdate">开始日期</param>
5: /// <param name="enddate">结束日期</param>
6: /// <returns></returns>
7: public static int GetDayInterval(DateTime startdate, DateTime enddate)
8: {
9: TimeSpan sts = new TimeSpan(startdate.Ticks);
10: TimeSpan ets = new TimeSpan(enddate.Ticks);
11: int days = ets.Subtract(sts).Duration().Days;
12: return days;
13: }