我知道这个已经有很多相似之处了。但是,每次我在不同日期转换日期时都会让我感到困惑。String was not recognized as a valid DateTime.
始终显示该消息。
我已经尝试了一些这样的代码:
Dim EffectiveDate As DateTime
EffectiveDate = DateTime.ParseExact("05/08/2012", "MM/dd/yyyy", Nothing)
EffectiveDate = DateTime.ParseExact("5/8/2012", "MM/dd/yyyy", Nothing)
EffectiveDate = DateTime.ParseExact("1/10/2012", "MM/dd/yyyy", Nothing)
EffectiveDate = DateTime.ParseExact("10/1/2012", "MM/dd/yyyy", Nothing)
//It resulted in got the message above
EffectiveDate = DateTime.ParseExact("10/10/2012", "MM/dd/yyyy", Nothing)
//It has no problem
代码有什么问题??非常感谢你。