sagar55 wrote:
TimeSpan total_diff=TimeSpan .Parse(date_diff ).Add( TimeSpan .Parse (time_diff ));
Problem is in this line of code.
sagar55 wrote:
TimeSpan .Parse (time_diff)
When you give this, Timespan is created as default of Day. So you define 1 day there to be added, thus you get 24 hours actually and not even 24 minutes!
Now, we can resolve it knowing this, but again there is a problem as you are defining date and time separately and handling separately.
You should do something like:
txtDateIn = "3/3/3010";
txtTimeIn = "12:06 AM";
txtDateOut = "3/3/3010";
txtTimeOut = "12:07 AM";
d1 = DateTime.Parse(txtDateIn + " " + txtTimeIn);
d2 = DateTime.Parse(txtDateOut + " " + txtTimeOut);
TimeSpan d_diff = d2.Subtract(d1);
txtCountTime.Text = d_diff.Minutes.ToString();