Reputation: 23275
Why does TimeSpan.FromSeconds(30).Milliseconds
evaluate to 0
when it would seem more correct for it to evaluate to 30000
?
Upvotes: 2
Views: 421
Reputation: 21855
You have to use TotalMilliseconds
instead of Milliseconds
. Milliseconds
return only the part of milliseconds of the DateTime "01:01:01:342" will return 342 milliseconds.
Upvotes: 2
Reputation: 2397
TotalMilliseconds
is what you are looking for. Milliseconds
returns the "remainder" milliseconds (i.e. the partial second)
Upvotes: 2