I have used a jquery ui datepicker in my hotel management system which I have been making in asp.net with C#. I want to know how to extract those checkout and checkout dates so that they could be in date format and then how to calculate the difference between them in order to calculate number of days.
问问题
1391 次
3 回答
0
var numberOfDays = (dateEnd - dateStart).TotalDays;
于 2013-10-21T12:52:43.843 回答
0
您可以为此编写扩展方法
public static double DaysFrom(this DateTime fromDate, DateTime toDate)
{
return (toDate - fromDate).TotalDays;
}
并称它为
fromDate.DaysFrom(toDate);
于 2013-10-21T13:00:03.940 回答
0
这是一个简单的代码
DateTime start = datePicker1.SelectedDate.Value.Date;
DateTime finish = datePicker2.SelectedDate.Value.Date;
TimeSpan difference = finish.Subtract(start);
var NumberOfDays = difference.TotalDays.ToString();
为了找到一个价值尝试这样
<input type="text" id="datepicker" name="datepicker" />
and in the code behind (C#):
Request.Form["datepicker"]
于 2013-10-21T12:54:26.243 回答