In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to understand the problem of 12-hour system and 24-hour system to obtain the zero of the day". In daily operation, I believe many people have doubts about how to understand the problem of 12-hour system and 24-hour system to obtain the zero of the day. The editor consulted all kinds of materials and sorted out a simple and useful method of operation. I hope it will be helpful for you to answer the question of "how to understand the 12-hour system and 24-hour system to get the zero of the day"! Next, please follow the editor to study!
The copy code is as follows:
DateTime dt = DateTime.Parse (DateTime.Now.ToString ("yyyy-MM-dd") + "00:00:00")
Console.WriteLine (dt.ToString ("yyyy-MM-dd HH:mm:ss"))
Locally, there is no problem with testing and QA environment testing, but there is a problem with this timing service after going to the public network server. After writing down the log, it is found that the zero point of the day is obtained, and the time obtained after putting it together is the zero point of the previous day. The original server time is 12 hours, and the local environment is 24 hours.
Continuing to dig deeper, it was found that the period from 00:00:00 to 00:59:59 of each day was the date of the day in the 24-hour system, but in the 12-hour system, it was from 12:00:00 to 12:59:59 of the day before yesterday. For example, according to the 24-hour time, today's "2013-09-26 00:00:00", in the 12-hour server, the acquisition is "2013-09-25 12:00:00", the date obtained by DateTime.Now.ToString ("yyyy-MM-dd") is "2013-09-25", then the dt acquisition is "2013-09-25 12:00:00".
It turns out that depending on the hourly system of getting time in C#, you can get it like this
The copy code is as follows:
/ / 24-hour system:
DateTime dt = DateTime.Now
String dt24 = dt.ToString ("yyyy-MM-dd HH:mm:ss")
/ / 12-hour system:
DateTime dt = DateTime.Now
String dt12 = dt.ToString ("yyyy-MM-dd hh:mm:ss")
/ / it is determined by the case of H.
Regardless of whether the server's time system is 12 hours or 24 hours, uppercase H gets 24 hours, and lowercase h gets 12 hours.
At this point, the study on "how to understand the 12-hour system and the 24-hour system to get the zero of the day" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.