I know how to calculate the difference between two timespans. But, i can only get one answer. Ms, seconds, minutes etc.
What i want is to compare two timespans, then get the difference in seconds + milliseconds.
Meaning if the difference is 10 seconds and 309 milliseconds, i would get.
10.309 as an answer.
I don´t think showing any codes of mine really matters here, as i got it all working, and it´s only to get the result i would like to know.
If you need anything from my code, please tell.
TimeSpan first;
TimeSpan last;
TimeSpan.TryParseExact(First.Text.Replace("-", ":").Remove(First.Text.LastIndexOf("-"),1).Insert(First.Text.Length-4,"."),"g",CultureInfo.InvariantCulture,out first);
TimeSpan.TryParseExact(Last.Text.Replace("-", ":").Remove(First.Text.LastIndexOf("-"), 1).Insert(First.Text.Length - 4, "."), "g", CultureInfo.InvariantCulture, out last);
TimeSpan u = first - last;
MessageBox.Show(u.TotalMilliseconds.ToString());
Use the "F" format specifier:
MessageBox.Show(u.TotalSeconds.ToString("F3"));