Megan Woodruff Megan Woodruff - 1 month ago 22
C# Question

Explanation: Time Span absolute value explanation

This isn't a coding question, it is more so a general question about the TimeSpan object in C#. One of the methods of the TimeSpan is a

Duration().
Per
MSDN, this method provides another TimeSpan object that contains the timespan as an absolute value.
I'm confused as to what absolute value means in this case. When I print the absolute value, I get 736179.14:46:32.5485475. I'm trying to understand what the absolute value of a timespan means so I can translate this value into the appropriate double variable.

Answer

Absolute value means the distance from zero without regard to the sign of the number. So -4 has an absolute value of 4.

Your number: 736179.14:46:32.5485475 is the absolute value of a Duration.

It is represented in the following format (which I presume is what is confusing to you):

Days.Hours:Minutes:Seconds.Fractional Seconds

736179 days  
14 hours  
46 minutes  
32 seconds  
5485475 Fractions of a second