I try to convert string type “dd.MM.yyyy HH:mm:ss.mmm” to the datetime using the way below:
DateTime result;
string c;
tarihSaat[n - 4] = DateTime.ParseExact(c, "dd.MM.yyyy HH:mm:ss.mmm", CultureInfo.InvariantCulture);
But I got FormatException error. How can I convert it?
Thanks..
This should do it, you can’t reuse a format string pattern twice (“m” in your sample), also you want to use “fff” for milliseconds. For details on custom date and time format strings check MSDN.