DateTime or int to string inside IQueryable?

c# entity-framework entity-framework-6 iqueryable

Accepted Answer

Utilize SqlFunctions.DateName

data.Where(o => SqlFunctions.DateName("year", o.SomeDateTime).Contains(searchParameter) ||
                SqlFunctions.DateName("month", o.SomeDateTime).Contains(searchParameter) ||
                SqlFunctions.DateName("weekday", o.SomeDateTime).Contains(searchParameter))

Depending on what would be needed, it might be necessary to search for data other than "year," "month," and "weekday."searchParameter seem to be.

Zzz-22-Zzz, there.

6
5/5/2014 3:29:59 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow