Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linq to Entity get a Date from DateTime

var islemList = (from isl in entities.Islemler where (isl.KayitTarihi.Date >= dbas && isl.KayitTarihi.Value.Date <= dbit) select isl);

It gives error: date is not supported in LINQ to Entities... How can i get date in linq.

like image 482
serkan Avatar asked Jul 06 '10 10:07

serkan


2 Answers

Use EntityFunctions.TruncateTime.

like image 91
Stephen Cleary Avatar answered Sep 27 '22 16:09

Stephen Cleary


if KayitTarihi is a date column in DB (and dbas and dbit are DateTime), use:

var islemList = (from isl in entities.Islemler where (isl.KayitTarihi >= dbas && isl.KayitTarihi <= dbit) select isl);
like image 29
Jaroslav Jandek Avatar answered Sep 27 '22 15:09

Jaroslav Jandek