how to get the Time difference
Hi Guys,
I would like to know how we can get the time difference in hours in C#.
Eg.
If i have a time A) 11:22 and B) 21:22
I need to know the difference between B and A with + ve or -ve diff.
That is A - B = - 10
Always this is my order of executiton ( A - B).
Awaiting a response.
Thanks,
Sunil.
Scott LyslePosted May 15, 2007, 12:45 AM
TimeSpan
ts = new TimeSpan();ts = DateTime.Now - dtp1.Value; MessageBox.Show(ts.Hours.ToString() + " hours, " +
ts.Minutes.ToString() + " minutes, and " +
ts.Seconds.ToString() + " seconds", "Time Difference");