How do you convert a string such as 2009-05-08 14:40:52,531
into a DateTime
?
C# – Converting a String to DateTime
cdatetime
Related Topic
- Mysql – How to set a default value for a MySQL Datetime column
- C# – How to convert a byte array to a hexadecimal string, and vice versa
- Mysql – Should I use the datetime or timestamp data type in MySQL
- C# – Case insensitive ‘Contains(string)’
- Python – Converting string into datetime
- C# – How to get a consistent byte representation of strings in C# without manually specifying an encoding
- C# DateTime to “YYYYMMDDHHMMSS” format
- Python – Converting unix timestamp string to readable date
Best Answer
Since you are handling 24-hour based time and you have a comma separating the seconds fraction, I recommend that you specify a custom format: