C# 获取时间差(天数)

public static int DateDiff(DateTime dateStart, DateTime dateEnd)
{
DateTime start = Convert.ToDateTime(dateStart.ToShortDateString());
DateTime end = Convert.ToDateTime(dateEnd.ToShortDateString());
TimeSpan sp = end.Subtract(start);
return sp.Days;
}

posted @ 2019-10-23 08:50  码农的崛起  阅读(10214)  评论(0编辑  收藏  举报