Is there any difference between
Convert.ToDateTime
and
DateTime.Parse
Which one is faster or which is more secure to use?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Per an answer on another forum from Jon Skeet…
If you’re not sure string is a valid
DateTime, use neither and instead, useDateTime.TryParse()If you’re sure the string is a valid
DateTime, and you know the format, you could also consider theDateTime.ParseExact()orDateTime.TryParseExact()methods.