In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to calculate the key point of time difference in c #". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to calculate the time difference in c #".
C # key points of calculating time difference:
Application of C # calculating time difference function TimeSpan
The TimeSpan value contains a number of properties and methods for accessing or processing a timespan value
The following list covers some of them:
Add: added to another timespan value.
Days: returns the timespan value calculated in days.
Duration: gets the absolute value of TimeSpan.
Hours: returns the timespan value calculated in hours
Milliseconds: returns the timespan value in milliseconds.
Minutes: returns the timespan value calculated in minutes.
Negate: returns the opposite number of the current instance.
Seconds: returns the timespan value calculated in seconds.
Subtract: subtracts another timespan value from it.
Ticks: returns the number of tick of the timespan value.
TotalDays: returns the number of days represented by the timespan value.
TotalHours: returns the number of hours represented by the timespan value.
TotalMilliseconds: returns the number of milliseconds represented by the timespan value.
TotalMinutes: returns the number of minutes represented by the timespan value.
TotalSeconds: returns the number of seconds represented by the timespan value.
C # implementation method of calculating time difference:
DateTime DateTime1, DateTime2 = DateTime.Now; / / now time DateTime1 = Convert.ToDateTime ("2009-04-24 20:00:00"); / / set the required minus time string dateDiff = null; TimeSpan ts1 = new TimeSpan (DateTime1.Ticks); TimeSpan ts2 = new TimeSpan (DateTime2.Ticks); TimeSpan ts = ts1.Subtract (ts2). Duration () / / display time dateDiff = ts.Days.ToString () + "days" + ts.Hours.ToString () + "hours" + ts.Minutes.ToString () + "minutes" + ts.Seconds.ToString () + "seconds" These are all the contents of the article "how to calculate the time difference in c #". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.