I have a string:
var stringDate = "8/19/2016 5:00:00 PM"
and I try using:
var dateTime = DateTime.ParseExact(stringDate,"M/d/yyyy h:mm:ss tt", null);
or
var dateTime = DateTime.ParseExact(stringDate, "M/d/yyyy h:mm:ss tt",
CultureInfo.Invariant);
or
var dateTime = DateTime.ParseExact(stringDate,"M/d/yyyy h:mm:ss tt",
CultureInfo.GetCultureInfo("en-us"));
It works fine if the machine is in the US but and for all 3 options I get the following error when running from a machine in London:
String was not recognized as a valid DateTime
what am I missing here?