How to find the Duration Time between two Times using C# ?


DateTime StartTime = DateTime.Now.ToLocalTime();
DateTime EndTime = DateTime.Now.ToLocalTime();
string dt = EndTime.Subtract(StartTime).ToString().Split('.')[0].ToString();
button1.Text = dt;


OutPut:
StartTime:8/7/2010 3:31:16 PM
EndTime:8/7/2010 3:32:07 PM
dt=00:00:50