Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是新来的,我一直在将值为“1024”和“2255”的字符串数组转换为时间值。
我需要将字符串转换为时间格式:“10:24 AM”。我将如何做到这一点?
提前致谢。
像这样的东西(我不介意):
var myString = "2255"; var dateTime = DateTime.ParseExact(myString,"HHmm", System.Globalization.CultureInfo.CurrentCulture); var convertedString = dateTime.ToString("hh:mm tt");
convertedString应该有“10:25 PM”
convertedString