日期:2014-05-18 浏览次数:20853 次
"MMM d yyyy hh:mm:ss:ffftt" "Aug 31 2007 12:05:12:000PM" //2007-8-31 12:05:12 "Aug 31 2007 12:05:12:000AM" //2007-8-31 0:05:12
------解决方案--------------------
谁告诉你的
Aug 31 2007 12:05:12:000PM 转换后应该是 2007-09-01 00:05:12
你又从哪里看到
Aug 31 2007 12:05:12:000PM 和 Aug 31 2007 12:05:12:000AM转换出来都是一样的了
Aug 31 2007 12:05:12:000AM 转换为24小时制应该是 Aug 31 2007 00:05:12:000
Aug 31 2007 12:05:12:000PM 转换为24小时制应该是 Aug 31 2007 12:05:12:000
先做过测试再说
DateTime dt1 = DateTime.ParseExact("Aug 31 2007 12:05:12:000AM", "MMM d yyyy hh:mm:ss:ffftt", CultureInfo.GetCultureInfo("en-US")); DateTime dt2 = DateTime.ParseExact("Aug 31 2007 12:05:12:000PM", "MMM d yyyy hh:mm:ss:ffftt", CultureInfo.GetCultureInfo("en-US")); MessageBox.Show(dt1.ToString("yyyy-MM-dd HH:mm:ss:fff") + "\n" + dt2.ToString("yyyy-MM-dd HH:mm:ss:fff"));