hi
I was trying to calculate differences between two dates which is getting from textboxes.
my code is,
protected void Button1_Click(object sender, EventArgs e)
{
DateTime a = Convert.ToDateTime(t1.Text);
DateTime b = Convert.ToDateTime(t2.Text);
System.TimeSpan d = b.Subtract(a);
System.TimeSpan d1 = b - a;
string c = (b - a).TotalDays.ToString();
t3.Text = c.ToString();
}
after clicking a button i am getting a error m as " String was not recognized as a valid DateTime.
"
{
DateTime a = Convert.ToDateTime(t1.Text);
DateTime b = Convert.ToDateTime(t2.Text);
System.TimeSpan d = b.Subtract(a);
System.TimeSpan d1 = b - a;
string c = (b - a).TotalDays.ToString();
t3.Text = c.ToString();
}
after clicking a button i am getting a error m as " String was not recognized as a valid DateTime.
"
Please help me to resolve this problem.
Amit KumarPosted Apr 25, 2016, 5:06 AM
Ravi PatelPosted Apr 25, 2016, 5:22 AM
Ranjit PowarPosted Apr 25, 2016, 5:20 AM
MounikaPosted Apr 25, 2016, 5:15 AM
Ranjit PowarPosted Apr 25, 2016, 5:11 AM
ramya tPosted Apr 25, 2016, 5:03 AM
ramya tPosted Apr 25, 2016, 4:59 AM
MounikaPosted Apr 25, 2016, 4:58 AM
ramya tPosted Apr 25, 2016, 4:58 AM
Ranjit PowarPosted Apr 25, 2016, 4:56 AM