-
string startDate = "2007/07/01";
-
string endDate = "2007/07/07";
-
DateTime dtStart = DateTime.ParseExact (startDate, "yyyy/MM/dd", null );
-
DateTime dtEnd = DateTime.ParseExact (endDate, "yyyy/MM/dd", null );
-
// 計算差異天數
-
TimeSpan tsDay = dtEnd - dtStart;
-
int dayCount = ( int ) tsDay.TotalDays;
|