I have three text boxes where I can enter time like on this screenshot:
Finally I want to get the difference of entry time (t1), exit time (t2) and break (t3): t1 - t2 - t3.
But I am not able to do that because of error message:
Operator '-' cannot be applied to operands of type 'System.TimeSpan' and 'System.DateTime'
My code is as follows:
DateTime t1, t2, t3, reserve;
t1 = DateTime.Parse(inBox.Text); //from text box1 eg.11:30
t2 = DateTime.Parse(outBox.Text); //from text box2 eg.12:30
t3 = DateTime.Parse(breakBox.Text); //from text box3 eg.0:30
TimeSpan diffTime = t2 - t1 -t3;// there is a problem doing this!!!
answerLabel.Text = diffTime.ToString();