TimeSpan is the object you need:
TimeSpan span = (DateTime.Now - DateTime.Now);
String.Format("{0} days, {1} hours, {2} minutes, {3} seconds",
span.Days, span.Hours, span.Minutes, span.Seconds);
More Related Contents:
- How do I calculate someone’s age based on a DateTime type birthday?
- Parse string to DateTime in C#
- DateTime vs DateTimeOffset
- Parse DateTime with time zone of form PST/CEST/UTC/etc
- String was not recognized as a valid DateTime ” format dd/MM/yyyy”
- Algorithm to detect overlapping periods [duplicate]
- How to truncate milliseconds off of a .NET DateTime
- C# DateTime.Now precision
- format date in c#
- How do I get the last day of a month?
- What does “DateTime?” mean in C#?
- How to compare DateTime in C#?
- Environment.TickCount vs DateTime.Now
- Why DateTime.AddHours doesn’t seem to work?
- How to convert Javascript datetime to C# datetime?
- How to find the 3rd Friday in a month with C#?
- How does DateTime.ToUniversalTime() work?
- Parse C# string to DateTime
- DateTime ToString issue with formatting months with “mm” specifier
- why does DateTime.ToString(“dd/MM/yyyy”) give me dd-MM-yyyy?
- How to ensure a timestamp is always unique?
- How can I format DateTime to web UTC format?
- datetime to string with time zone
- How frequent is DateTime.Now updated ? or is there a more precise API to get the current time?
- DateTime conversion from string C#
- Getting the first and last day of a month, using a given DateTime object
- Convert DateTime to long and also the other way around
- .NET: Why is TryParseExact failing on Hmm and Hmmss?
- LINQ Query to Convert string to datetime
- .NET DateTime to SqlDateTime Conversion