I have a simple string date as: "11/28/2022"
And I try to convert to DateTime as:
var currentStartDate = DateTime.ParseExact(
model.StartDate,
"dd/MM/yyyy",
CultureInfo.InvariantCulture
);
but it throw:
System.FormatException: The DateTime represented by the string '11/28/2022' is not supported in calendar 'System.Globalization.GregorianCalendar'.
Or
var currentStartDate = DateTime.Parse(model.StartDate);
But it is throwing an error two, how can I convert the date to DateTime?