Hi,
I have 2 textbox with calender extender binded to them. I am forcing the user to select from date and to date from the calender (format is dd-MM-yy) and i want to display the number of days it comes up to in another textbox which will again be saved as duration in a sql table.. how do i calculate the days? plzz help... Like for ex: i have started the project from 21/6/11 and it will be done till 21/11/11.. i want to calculate the no of days /months and display it in another textbox immediately after the dates for both textbox are selected.. How do i do it plzz help
Loading
Posted Jun 21, 2011, 3:34 AM
http://www.c-sharpcorner.com/UploadFile/mahesh/TwoDatesDifference08052005152233PM/TwoDatesDifference.aspx
DateTime fromDate = Convert.ToDateTime(TextBox1.Text);
DateTime toDate = Convert.ToDateTime(TextBox2.Text);
TimeSpan diff = toDate.Subtract(fromDate);
Response.Write("Diiference " + diff.Days);