DateTime STime = DateTime.Parse("2005-11-08"); //起始日
DateTime ETime = DateTime.Parse("2005-12-28"); //結束日
TimeSpan Total = ETime.Subtract(STime); //日期相減
Response.Write(Total.Days.ToString()); //共幾天
Response.Write(Total.Hours.ToString()); //共幾小時
Response.Write(Total.Minutes.ToString()); //共幾分
Response.Write(Total.TotalDays.ToString()); //總共多少天
Response.Write(Total.TotalHours.ToString()); //總共多少小時
Response.Write(Total.TotalSeconds.ToString()); //總共多少分