方法一:
DateTime dt1 = Convert.ToDateTime("2013-09-30");
DateTime dt2 = DateTime.Now;
int count = Convert.ToInt32((dt2 - dt1).TotalDays) - 1;
count即为dt1距离dt2的天数
方法二:
DateTime dtone = Convert.ToDateTime(DateTime.Now);
DateTime dtwo = Convert.ToDateTime("2007-1-1 04:20:15");
TimeSpan span = dtone.Subtract(dtwo);
Response.Write(span.Days + "天" + span.Hours + "小时" + span.Minutes + "分钟" + span.Seconds+"秒");
原文地址:http://www.cnblogs.com/iwin9999/p/3998448.html