two calenders
one button
One text box
I need to get the difference of two selected dates in day wise(i.e.. 1 day, or 2 days, or 3 days)
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 11, 2014, 10:46 AM
protected button1_Click(object sender, EventArgs e)
{
DateTime dt1 = calendar1.SelectedDate.Date;
DateTime dt2 = calendar2.SelectedDate.Date;
int days = (int)Math.Abs((dt1 - dt2).TotalDays);
textBox1.Text = days.ToString();
}