[Solved] String not valid as a datetime string – Convert “yyyyMMdd” to datetime [closed]


Use DateTime.ParseExact to specify the format and invariant culture:

var date = DateTime.ParseExact(date, "yyyyMMdd", CultureInfo.InvariantCulture);

solved String not valid as a datetime string – Convert “yyyyMMdd” to datetime [closed]