Reputation: 1071
This
DateTime EndTime = DateTime.ParseExact("24/07/2015 12:00 AM", "DD/MM/YYYY hh:mm tt", new CultureInfo("en-US"));
generates
String was not recognized as a valid DateTime.
And I cannot seem to find the problem.
Upvotes: 1
Views: 91
Reputation: 53958
Please try this one:
DateTime EndTime = DateTime.ParseExact("24/07/2015 12:00 AM", "dd/MM/yyyy hh:mm tt", new CultureInfo("en-US"));
The problem is that the specified format didn't match the format of the string you passed.
Upvotes: 3