How to calculate time duration using two webDateChoosers (Ex:-From Date & To Date - Need to calculate Number of days)
And how to validate From Date with System date??
Please give me the solutions ASAP..
Thank You.
Hello,
I have created a sample for you on how to calculate number of days. Please also refer to the below lines of code. Attached is the sample.
16 DateTime startDate = DateTime.MinValue;
17 DateTime endDate = DateTime.MinValue; ;
18 DateTime.TryParse(WDCStartDate.Value.ToString(), out startDate);
19 DateTime.TryParse(WDCEndDate.Value.ToString(),out endDate);
20
21 if (startDate != DateTime.MinValue && endDate != DateTime.MinValue)
22 {
23 System.TimeSpan diff1 = endDate.Subtract(startDate);
24 int days = diff1.Days;
25 Label1.Text = "Number of Days = " + days;
26 }