Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8527827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:40:00+00:00 2026-06-11T08:40:00+00:00

I am using the dynamic linq library with entity framework and want to compare

  • 0

I am using the dynamic linq library with entity framework and want to compare dates. I have succesfully extended the library based on the following SO article here However what I can not seem to do is to get the library to compare just the date portion of the DateTime property of my entity object as I would do with a normal linq expression.

What I am trying to do is have the dynamic linq create a lambda like this:

// Compare just dates
p => p.CreatedDate.Value.Date == '2012/08/01'

Rather than:

// Compares date + time
p => p.CreatedDate == '2012/08/01'

Any ideas on this would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:40:01+00:00Added an answer on June 11, 2026 at 8:40 am

    The Dynamic Linq parser supports all public members of the System.DateTime type, including the Date property. So you could do something like

    DateTime comparisonDate = new DateTime(2012, 8, 1);
    var query = items.Where("CreatedDate.Value.Date == @0", comparisonDate);
    

    UPDATE: If you are using Entity Framework this example will not work, since it does not support translating the DateTime.Date property into SQL. Normally you could use the EntityFunctions.TruncateTime() function to achieve the same effect, but this function is not accessible to the Dynamic Linq parser without modifications. However, you should be able to to do something similar to the following (haven’t tested):

    var query = items.Where("CreatedDate.Value.Year == @0.Year && CreatedDate.Value.Month == @0.Month && CreatedDate.Value.Day== @0.Day", comparisonDate);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am following Scott Gu's article to create a dynamic LINQ http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx He has
Using Entity Framework 4, I'm trying to implement dynamic sorting based on a collection
I'm using jqGrid and I have a problem getting Dynamic Linq to work. I
Using the Dynamic LINQ library ( link ), is it vulnerable to injection? and
I have been trying to use dynamic LINQ to Entity in my application for
I'm using the Dynamic.ParseLambda method from the Dynamic LINQ library to create expressions, compile
Using LINQ , I've been trying to use the System.Linq.Dynamic library in order to
Ok so in our project I'm using System.Linq.Dynamic library but I just noticed that
I'm using the Dynamic LINQ library code sample to dynamically return some data. The
I have seen this code Sortable JqGrid using LINQ to MySQL (DbLinq) and Dynamic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.