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);
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
- Convert UTC/GMT time to local time
- Is DateTime.Now the best way to measure a function’s performance? [closed]
- Algorithm to detect overlapping periods [duplicate]
- Creating a DateTime in a specific Time Zone in c#
- How to create a .NET DateTime from ISO 8601 format
- String was not recognized as a valid DateTime ” format dd/MM/yyyy”
- How to truncate milliseconds off of a .NET DateTime
- C# DateTime.Now precision
- How to get difference between two dates in Year/Month/Week/Day?
- How to know if a DateTime is between a DateRange in C#
- format date in c#
- calculating the difference in months between two dates
- How do I get the last day of a month?
- How to get client date and time in ASP.NET?
- What does “DateTime?” mean in C#?
- Get Month name from month number
- Measuring code execution time
- Format a date in XML via XSLT
- How to compare DateTime in C#?
- How do I represent a time only value in .NET?
- DateTime conversion from string C#
- Environment.TickCount vs DateTime.Now
- Convert DateTime for MySQL using C#
- How to convert Javascript datetime to C# datetime?
- Why DateTime.AddHours doesn’t seem to work?
- Parse C# string to DateTime
- How can I format DateTime to web UTC format?
- DateTime ToString issue with formatting months with “mm” specifier
- How do I get the AM/PM value from a DateTime?
- Getting Date or Time only from a DateTime Object
- How does DateTime.ToUniversalTime() work?
- How to find the 3rd Friday in a month with C#?
- why does DateTime.ToString(“dd/MM/yyyy”) give me dd-MM-yyyy?
- Difference between System.DateTime.Now and System.DateTime.Today
- datetime to string with time zone
- Convert String to Date in .NET if my incoming date format is in YYYYMMDD
- How to ensure a timestamp is always unique?
- DateTime.Parse(“2012-09-30T23:00:00.0000000Z”) always converts to DateTimeKind.Local
- How frequent is DateTime.Now updated ? or is there a more precise API to get the current time?
- Getting the first and last day of a month, using a given DateTime object
- .NET DateTime to SqlDateTime Conversion
- Why doesn’t .NET/C# optimize for tail-call recursion?
- Why does Enumerable.All return true for an empty sequence? [duplicate]
- What method in the String class returns only the first N characters?
- Difference between IEnumerable Count() and Length
- Consume a SOAP web service without relying on the app.config