2
我想将字符串5/4/2017 2:15:50 PM转换为日期时间。我用DateTime.ParseExact的格式字符串 - 什么小时格式适用于“tt”?
statustime="5/4/2017 2:15:50 PM"
statustimefrm=DateTime.Parse(statustime, Globalization.CultureInfo.CurrentCulture)
它的工作,但我宁愿使用ParseExact。我用
statustimefrm=DateTime.Parse(statustime, "M/d/yyyy HH:mm:ss tt",Globalization.CultureInfo.CurrentCulture)
但它给了我一个格式错误。有人会知道使用的格式吗?
把它改为DateTime.ParseExact(时间跨度, “M/d/yyyy的H:M:S TT”,CultureInfo.InvariantCulture) ; – Aparna