I have the following code
var dates = query.Select(
x => DateTime.ParseExact(x.Date, \"yyyy-MM\", CultureInfo.InvariantCulture));
var minDat
LINQ to Entities takes your LINQ query and converts it to SQL code that it then executes against the database. That means that the code you write has to be able to be converted to SQL code. There is no way to convert DateTime.ParseExact to SQL code, hence the exception. You will need to evaluate a LINQ to Entities query by calling ToArray and then you can perform a second LINQ to Objects query on that and it will understand DateTime.ParseExact.