I get "10/1/15 12:00:00 AM" time string from mysql db. How to convert this to a System.DateTime by the ParseExact method?
1 Answer
You can use DateTime.ParseExact method with a custom date and time format.
I assume your 10 is as a day;
var dt = DateTime.ParseExact("10/1/15 12:00:00 AM", "dd/M/yy hh:mm:ss tt",
CultureInfo.InvariantCulture);
By the way, of course saving your DateTime as a string in your database is a bad idea. Change your column type to DATETIME data type if you can.
String? And not as already mappedDateTime?