I have a timespan that displays as such: 7.43053333333333
. My goal is to simply display it as 7.43
.
How would I truncate two the second value after the decimal place. I tried using Math.Round
instead of truncating, but it would simnple return 7
Just use Math.Round Method (Decimal, Int32)
double d = 7.43053333333333;
double ma = Math.Round(d, 2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With