[Solved] DateTime.ParseExact() – DateTime pattern ‘y’ appears more than once with different values


Your format should be yyyy-MM-dd HH:mm:ss.fff

string testDateRaw = @"2014-05-21 10:08:15.965";
string format = "yyyy-MM-dd HH:mm:ss.fff";
DateTime testDate = DateTime.ParseExact(testDateRaw, format, CultureInfo.InvariantCulture);
System.Console.WriteLine(testDate);

See: Custom Date and Time Format Strings

solved DateTime.ParseExact() – DateTime pattern ‘y’ appears more than once with different values