HI
I have 2 textboxes, both of which have been enabled with Ajax datetimepicker calendar tool. The textboxes would display the time and date in this format "dd-mm-yy hh:mm am/pm" An example of the text would be "06-03-2013 12:00pm" . What I would like to do is, to get the difference between the two dates in the 3rd textbox.
I came across examples that use TimeSpan. I have done this so far
protected void Button1_Click(object sender, EventArgs e) { DateTime D1 = DateTime.Parse(datepicker.Text); DateTime D2 = DateTime.Parse(datepicker1.Text); TimeSpan TextBox1 = D2.Subtract(D1); }
I think it is not working because of this formatting. How do I correct the code above. I would like to have the code to return the following upon Button1_Click.
Value of 1st Text box = 06-03-2013 12:00pm
Value of 2nd Text box = 06-03-2013 4:30pm
Value of 3rd Text box should be = 4.30