need to calculate the date difference in asp.net
in 1st textbox 01/10/2014
in 2nd textbox i pick 3/10/2014
i need to show as 3 days
protected void Button4_Click(object sender, EventArgs e) { DateTime start = DateTime.Parse(TextBox7.Text); DateTime end = DateTime.Parse(TextBox8.Text); TimeSpan Difference = (end - start); int a = Difference.Days; Label1.Text = (a+1) + " Days"; }
Output:
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.