If you want subtract 2 times, such as t3=t2-t1, you need to do this:
DateTime t1, t2;
TimeSpan t3;
t3 = t2.Subtract(t1);
var text = t3.ToString();
T3 needs to be a TimeSpan not a date time. The subtraction of two times is a time span not a time itself. as in 1:20 - 1:10 = 10 minutes. 10 minutes is not a time it is a time span.
Hope this helpful
Regards
Young Yang
Please mark the replies as answers if they help or unmark if not.
Feedback to us
Young Yang -...
All-Star
21344 Points
1818 Posts
Microsoft
Re: Do I need a cast here?
May 04, 2012 08:33 AM|LINK
Hi
If you want subtract 2 times, such as t3=t2-t1, you need to do this:
T3 needs to be a TimeSpan not a date time. The subtraction of two times is a time span not a time itself. as in 1:20 - 1:10 = 10 minutes. 10 minutes is not a time it is a time span.
Hope this helpful
Regards
Young Yang
Feedback to us
Develop and promote your apps in Windows Store