DateTime dt = DateTime.ParseExact("05/27/2016 8:00 AM", "dd/MM/yyyy", CultureInfo.InvariantCulture);
Can "05/27/2016 8:00" be mapped
exactly to "dd/MM/yyyy"? No it can't hence the error. If you want to use the dd/MM/yyyy parse format your string has to match that format, so remove the time from your string.
DateTime dt = DateTime.ParseExact("05/27/2016", "dd/MM/yyyy", CultureInfo.InvariantCulture);
Will that work? Still no. You are saying "05" is the day and "27" is the month, there is no 27th month. So make your date string match the format like this
DateTime dt = DateTime.ParseExact("05/27/2016", "MM/dd/yyyy", CultureInfo.InvariantCulture);
Or use the proper format for the string you have, like this
DateTime dt = DateTime.ParseExact("05/27/2016 8:00 AM", "MM/dd/yyyy h:mm tt", CultureInfo.InvariantCulture);
Custom Date and Time Format Strings[
^]
If what you're trying to do is create a DateTime object where the date is a specific format (the one you have in your format string) then dates don't work like that, they don't have a format until you convert them to a string. So you convert your string to DateTime and that DateTime represents that moment in time, and if you want to display that moment in time in a certain format you use ToString on the DateTime and specify the format you what the DateTime represented as.