Entity Framework 6 使用DbFunctions.TruncateTime(DateTime? obj),再比較日期:
var query = db.Table.Where(x => DbFunctions.TruncateTime(x.CreateTime).Value == new DateTime(2000,1,1));
Entity Framework 5以前 使用EntityFunctions.TruncateTime(DateTime? obj),再比較日期:
var query = db.Table.Where(x => EntityFunctions.TruncateTime(x.CreateTime).Value == new DateTime(2000,1,1));
沒有留言:
張貼留言