Per an answer on another forum from Jon Skeet...
Convert.ToDateTime uses DateTime.Parse internally, with the current
culture - unless you pass it null, in which case it returns
DateTime.MinValue.
If you're not sure string is a valid DateTime
, use neither and instead, use DateTime.TryParse()
If you're sure the string is a valid DateTime
, and you know the format, you could also consider the DateTime.ParseExact()
or DateTime.TryParseExact()
methods.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…